From be5b95a007f402564ec1f375a6fe2df109d97b66 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Wed, 21 Oct 2020 17:04:44 -0700 Subject: [PATCH] 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. --- lib/gvc/gvplugin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 = ""; -- 2.50.1