>From 58329ce8534001d0cddf037fe22f07fb4b6ca65d Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Sat, 15 Nov 2014 22:33:34 +0100 Subject: [PATCH] Fix memory leak --- 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 515b9511fd0a2cf3b31db9da1fe9ef2168011e54..d2bd0e46ade0d7e8a9dc780e59b20418d9c2ca91 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) { -- 2.1.0