提交 7ed02a00 编写于 作者: P Pavel Hrdina

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: NPavel Hrdina <phrdina@redhat.com>
上级 ba906a3d
...@@ -136,6 +136,7 @@ openvzParseBarrierLimit(const char* value, ...@@ -136,6 +136,7 @@ openvzParseBarrierLimit(const char* value,
char *token; char *token;
char *saveptr = NULL; char *saveptr = NULL;
char *str; char *str;
int ret = -1;
if (VIR_STRDUP(str, value) < 0) if (VIR_STRDUP(str, value) < 0)
goto error; goto error;
...@@ -158,10 +159,10 @@ openvzParseBarrierLimit(const char* value, ...@@ -158,10 +159,10 @@ openvzParseBarrierLimit(const char* value,
goto error; goto error;
} }
} }
return 0; ret = 0;
error: error:
VIR_FREE(str); VIR_FREE(str);
return -1; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册