mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 12:05:17 +00:00
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: Wang Rui <moon.wangrui@huawei.com>
This commit is contained in:
parent
cd2d7c6c3a
commit
89060bd90e
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user