]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
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 03218e249ec3b69b8863c245628514a5ae32a225..6e5efd64ed38f95181faa8cb1ce1a8dadb7483e4 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1048,7 +1048,6 @@ static void close_stat_pipe(void)
 {
        if (!stat_task->ct)
                return;
 {
        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();
        client_close(stat_task->ct);
        stat_task->ct = NULL;
        clear_and_dump_items();
index 865a1797bd81bbd7e6308278c08249890c1bf241..eb9f9e1fcda2a49ba960582ba67be9c882897a20 100644 (file)
@@ -44,6 +44,7 @@ void client_close(struct client_task *ct)
        free(ct->user);
        free(ct->config_file);
        free(ct->key_file);
        free(ct->user);
        free(ct->config_file);
        free(ct->key_file);
+       btr_free_node(ct->btrn);
        client_cmdline_parser_free(&ct->conf);
        free(ct);
 }
        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);
        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;
        }
                client_close(ct);
                *ct_ptr = NULL;
        }