[master] c4710e95d varnishadm: Plug unlikely leak

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jan 31 16:56:05 UTC 2022


commit c4710e95d15d11a927da190f2f9e8d7c9e0452b3
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Jan 31 17:51:22 2022 +0100

    varnishadm: Plug unlikely leak
    
    Spotted by Coverity Scan.

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 83b86f7f1..d978dcdaa 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -253,9 +253,9 @@ command_generator (const char *text, int state)
 			return (NULL);
 		}
 		jsn_cmds = vjsn_parse(answer, &err);
+		free(answer);
 		if (err != NULL)
 			return (NULL);
-		free(answer);
 		AN(jsn_cmds);
 		AN(jsn_cmds->value);
 		assert (vjsn_is_array(jsn_cmds->value));


More information about the varnish-commit mailing list