From: Matthias Bolte Date: Sat, 30 Apr 2011 10:06:29 +0000 (+0200) Subject: Fix memory leak in __virExec X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d50b323a9e2dc4e13e2dc7ecb99cf9dee309f59;p=libvirt.git Fix memory leak in __virExec Commit e0d014f2379dd made binary potentially allocated on the heap. It was freed in the parent in the error path, but not in the success path that doesn't goto the cleanup label. Found by 'make -C tests valgrind'. --- diff --git a/src/util/util.c b/src/util/util.c index c337aa9ef8..37472bb8a5 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -568,6 +568,10 @@ __virExec(const char *const*argv, } *retpid = pid; + + if (binary != argv[0]) + VIR_FREE(binary); + return 0; }