From: Pavel Hrdina Date: Mon, 13 Jan 2014 13:33:15 +0000 (+0100) Subject: Fix memory leak in openvz_conf.c X-Git-Tag: CVE-2014-0028~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ed02a0003f3518cdecaf0b34b7622451d6629f3;p=thirdparty%2Flibvirt.git Fix memory leak in openvz_conf.c If there is no error while executing a function "openvzParseBarrierLimit" a "str" string where is duplicate of a "value" string isn't freed and it leads into memory leak. This has been found by coverity. Signed-off-by: Pavel Hrdina --- diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 0dbaa4a877..91b16f8aed 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -136,6 +136,7 @@ openvzParseBarrierLimit(const char* value, char *token; char *saveptr = NULL; char *str; + int ret = -1; if (VIR_STRDUP(str, value) < 0) goto error; @@ -158,10 +159,10 @@ openvzParseBarrierLimit(const char* value, goto error; } } - return 0; + ret = 0; error: VIR_FREE(str); - return -1; + return ret; }