From: Matthew Fernandez Date: Thu, 22 Oct 2020 00:04:44 +0000 (-0700) Subject: fix memory leak in gvplugin_list X-Git-Tag: 2.46.0~20^2^2~9^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be5b95a007f402564ec1f375a6fe2df109d97b66;p=graphviz fix memory leak in gvplugin_list It seems clear these conditionals were reversed and were meant to read `if (typestr_list)`. Rather than flip their polarity, we just remove them as it is safe to free NULL. --- diff --git a/lib/gvc/gvplugin.c b/lib/gvc/gvplugin.c index 576b8d96d..de3b04866 100644 --- a/lib/gvc/gvplugin.c +++ b/lib/gvc/gvplugin.c @@ -397,12 +397,10 @@ char *gvplugin_list(GVC_t * gvc, api_t api, const char *str) agxbprint(&xb, " %s", q); new = FALSE; } - if (!typestr_last) - free(typestr_last); + free(typestr_last); typestr_last = q; } - if (!typestr_last) - free(typestr_last); + free(typestr_last); } if (new) bp = "";