[master] e773852 Free temp VSM structure when finished with it in n_arg_sock
Martin Blix Grydeland
martin at varnish-cache.org
Tue Oct 1 14:48:20 CEST 2013
commit e773852f5dfa3d7b968aedfc0338d822a51d4008
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Tue Oct 1 13:35:08 2013 +0200
Free temp VSM structure when finished with it in n_arg_sock
Spotted by: Coverity
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index e7dc7ba..f356546 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -387,17 +387,21 @@ n_arg_sock(const char *n_arg)
struct VSM_fantom vt;
vsm = VSM_New();
+ AN(vsm);
if (VSM_n_Arg(vsm, n_arg) < 0) {
fprintf(stderr, "%s\n", VSM_Error(vsm));
+ VSM_Delete(vsm);
return (-1);
}
if (VSM_Open(vsm)) {
fprintf(stderr, "%s\n", VSM_Error(vsm));
+ VSM_Delete(vsm);
return (-1);
}
if (!VSM_Get(vsm, &vt, "Arg", "-T", "")) {
fprintf(stderr, "No -T arg in shared memory\n");
+ VSM_Delete(vsm);
return (-1);
}
AN(vt.b);
@@ -408,6 +412,8 @@ n_arg_sock(const char *n_arg)
S_arg = strdup(vt.b);
}
+ VSM_Delete(vsm);
+
sock = -1;
while (*T_arg) {
p = strchr(T_arg, '\n');
More information about the varnish-commit
mailing list