From bda95f9508b456dcea89d300f6d4104e30ab9f3e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 10 Jun 2011 00:01:09 +0200 Subject: [PATCH] client: Do not leak buffer tree node on exit. 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 | 1 - client_common.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/audiod.c b/audiod.c index 03218e24..6e5efd64 100644 --- 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(); diff --git a/client_common.c b/client_common.c index 865a1797..eb9f9e1f 100644 --- a/client_common.c +++ b/client_common.c @@ -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; } -- 2.39.5