From: Matthew Fernandez Date: Sat, 30 May 2020 02:10:19 +0000 (-0700) Subject: fix memory leak due to config text X-Git-Tag: 2.44.1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0222351d7658307b3cf7bdcd047cf12188d1ddda;p=graphviz fix memory leak due to config text We now no longer retain pointers to this variable internally, so we can unconditionally free it. Fixes #1543. --- diff --git a/lib/gvc/gvconfig.c b/lib/gvc/gvconfig.c index aaae4f15d..d2e3325b7 100644 --- a/lib/gvc/gvconfig.c +++ b/lib/gvc/gvconfig.c @@ -543,14 +543,13 @@ void gvconfig(GVC_t * gvc, boolean rescan) sz = fread(config_text, 1, config_st.st_size, f); if (sz == 0) { agerr(AGERR,"%s is zero sized, or other read error.\n", gvc->config_path); - free(config_text); } else { gvc->config_found = TRUE; config_text[sz] = '\0'; /* make input into a null terminated string */ rc = gvconfig_plugin_install_from_config(gvc, config_text); - /* NB. config_text not freed because we retain char* into it */ } + free(config_text); } if (f) { fclose(f);