提交 89060bd9 编写于 作者: W Wang Rui 提交者: John Ferlan

test_conf: Resolve Coverity RESOURCE_LEAK

If the condition 'ret < 0' is true, the code will jump to
'cleanup' and 'conf' won't be freed.
Signed-off-by: NWang Rui <moon.wangrui@huawei.com>
上级 cd2d7c6c
......@@ -11,7 +11,7 @@
int main(int argc, char **argv)
{
int ret, exit_code = EXIT_FAILURE;
virConfPtr conf;
virConfPtr conf = NULL;
int len = 10000;
char *buffer = NULL;
......@@ -34,7 +34,6 @@ int main(int argc, char **argv)
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
goto cleanup;
}
virConfFree(conf);
if (fwrite(buffer, 1, len, stdout) != len) {
fprintf(stderr, "Write failed: %s\n", strerror(errno));
goto cleanup;
......@@ -44,5 +43,6 @@ int main(int argc, char **argv)
cleanup:
VIR_FREE(buffer);
virConfFree(conf);
return exit_code;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册