From 5ac60f47e2404603690ae509252a852ac2d74c61 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 11 Feb 2007 23:45:52 +0100 Subject: [PATCH] recv_common: fix memory leak and invalid free in error path As split_args() returns pointers that point within the given string, it is wrong to free the individual pieces. However, the array of substrings must be freed. parse_receiver_args() got both of these wrong :( --- recv_common.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/recv_common.c b/recv_common.c index 8f8f6369..c14455d0 100644 --- a/recv_common.c +++ b/recv_common.c @@ -51,12 +51,7 @@ static void *parse_receiver_args(int receiver_num, char *options) argv[1] = NULL; } conf = r->parse_config(argc, argv); - if (!conf) { - for (i = 0; i < argc; i++) - free(argv[i]); - free(argv); - return NULL; - } + free(argv); return conf; } -- 2.39.5