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 <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2014-01-13 14:33:15 +01:00
parent ba906a3d58
commit 7ed02a0003
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}