client: Do not leak buffer tree node on exit.
authorAndre Noll <maan@systemlinux.org>
Thu, 9 Jun 2011 22:01:09 +0000 (00:01 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 9 Jul 2011 12:28:06 +0000 (14:28 +0200)
Currently we deallocate the buffer tree node of the client
task in case the connect fails and in audiod.c's close_stat_pipe()
but miss to free it for para_client in case of a regular connection
shutdown.

Fix this memory leak by freeing the buffer tree node in
client_close().

audiod.c
client_common.c

index 03218e2..6e5efd6 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1048,7 +1048,6 @@ static void close_stat_pipe(void)
 {
        if (!stat_task->ct)
                return;
-       btr_free_node(stat_task->ct->btrn);
        client_close(stat_task->ct);
        stat_task->ct = NULL;
        clear_and_dump_items();
index 865a179..eb9f9e1 100644 (file)
@@ -44,6 +44,7 @@ void client_close(struct client_task *ct)
        free(ct->user);
        free(ct->config_file);
        free(ct->key_file);
+       btr_free_node(ct->btrn);
        client_cmdline_parser_free(&ct->conf);
        free(ct);
 }
@@ -418,7 +419,6 @@ out:
        if (ret < 0) {
                PARA_ERROR_LOG("%s\n", para_strerror(-ret));
                btr_remove_node(ct->btrn);
-               btr_free_node(ct->btrn);
                client_close(ct);
                *ct_ptr = NULL;
        }