]> granicus.if.org Git - graphviz/commitdiff
fix memory leak in gvplugin_list
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Oct 2020 00:04:44 +0000 (17:04 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 29 Oct 2020 00:13:12 +0000 (17:13 -0700)
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

index 576b8d96dc9d9bd91a7219896a4d1257d4979b12..de3b04866c935b868dbef8b7ab8e951de94d20bd 100644 (file)
@@ -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 = "";