From 5a99c4873bd79adf8359370869469f745eec8c35 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Sat, 15 Nov 2014 22:33:34 +0100 Subject: Fix memory leak Signed-off-by: Lukas Slebodnik Reviewed-by: Simo Sorce --- proxy/src/gp_config_dinglibs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/proxy/src/gp_config_dinglibs.c b/proxy/src/gp_config_dinglibs.c index 515b951..d2bd0e4 100644 --- a/proxy/src/gp_config_dinglibs.c +++ b/proxy/src/gp_config_dinglibs.c @@ -87,6 +87,7 @@ int gp_dinglibs_get_string_array(struct gp_ini_context *ctx, int ret; int i, count = 0; const char **array = NULL; + const char **t_array; if (!values || !num_values) { return EINVAL; @@ -144,11 +145,12 @@ int gp_dinglibs_get_string_array(struct gp_ini_context *ctx, goto done; } - array = realloc(array, (count+1) * sizeof(char *)); - if (array == NULL) { + t_array = realloc(array, (count+1) * sizeof(char *)); + if (t_array == NULL) { ret = ENOMEM; goto done; } + array = t_array; array[count] = strdup(value); if (array[count] == NULL) { -- cgit