[4.0] 02e38f7 Fix two small resource leaks to make coverity happy

Tollef Fog Heen tfheen at err.no
Tue Apr 1 15:09:52 CEST 2014


commit 02e38f7f26e35a23faf4356ab6b7d3bae264cffa
Author: Tollef Fog Heen <tfheen at fastly.com>
Date:   Thu Mar 20 20:05:41 2014 +0100

    Fix two small resource leaks to make coverity happy

diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index e1686ad..90016a9 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -128,6 +128,7 @@ cli_sock(const char *T_arg, const char *S_arg)
 	if (status != CLIS_OK) {
 		fprintf(stderr, "Rejected %u\n%s\n", status, answer);
 		AZ(close(sock));
+		free(answer);
 		return (-1);
 	}
 	free(answer);
@@ -137,7 +138,8 @@ cli_sock(const char *T_arg, const char *S_arg)
 	if (status != CLIS_OK || strstr(answer, "PONG") == NULL) {
 		fprintf(stderr, "No pong received from server\n");
 		AZ(close(sock));
-		return(-1);
+		free(answer);
+		return (-1);
 	}
 	free(answer);
 



More information about the varnish-commit mailing list