mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: fix some resource leaks
Found by running valgrind for these tests. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
ab0a461b8c
commit
9005a64b5c
@ -1093,6 +1093,9 @@ static int test25(const void *unused ATTRIBUTE_UNUSED)
|
|||||||
virCommandPtr cmd = virCommandNew("some/nonexistent/binary");
|
virCommandPtr cmd = virCommandNew("some/nonexistent/binary");
|
||||||
|
|
||||||
rv = virCommandExec(cmd);
|
rv = virCommandExec(cmd);
|
||||||
|
|
||||||
|
virCommandFree(cmd);
|
||||||
|
|
||||||
if (safewrite(pipeFD[1], &rv, sizeof(rv)) < 0)
|
if (safewrite(pipeFD[1], &rv, sizeof(rv)) < 0)
|
||||||
fprintf(stderr, "Unable to write to pipe\n");
|
fprintf(stderr, "Unable to write to pipe\n");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
|
@ -534,6 +534,8 @@ mymain(void)
|
|||||||
"/usr/bin/qemu-system-s390x", NULL,
|
"/usr/bin/qemu-system-s390x", NULL,
|
||||||
"s390x", VIR_DOMAIN_VIRT_KVM);
|
"s390x", VIR_DOMAIN_VIRT_KVM);
|
||||||
|
|
||||||
|
virObjectUnref(cfg);
|
||||||
|
|
||||||
#endif /* WITH_QEMU */
|
#endif /* WITH_QEMU */
|
||||||
|
|
||||||
#if WITH_LIBXL
|
#if WITH_LIBXL
|
||||||
|
@ -315,6 +315,7 @@ manageVHBAByStoragePool(const void *data)
|
|||||||
ignore_value(virStoragePoolDestroy(pool));
|
ignore_value(virStoragePoolDestroy(pool));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
virNodeDeviceFree(dev);
|
||||||
|
|
||||||
if (virStoragePoolDestroy(pool) < 0)
|
if (virStoragePoolDestroy(pool) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -322,6 +323,7 @@ manageVHBAByStoragePool(const void *data)
|
|||||||
if ((dev = virNodeDeviceLookupByName(conn, expect_hostname))) {
|
if ((dev = virNodeDeviceLookupByName(conn, expect_hostname))) {
|
||||||
VIR_DEBUG("Found expected_hostname '%s' after destroy",
|
VIR_DEBUG("Found expected_hostname '%s' after destroy",
|
||||||
expect_hostname);
|
expect_hostname);
|
||||||
|
virNodeDeviceFree(dev);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,8 +429,10 @@ static void init_sysfs(void)
|
|||||||
abort(); \
|
abort(); \
|
||||||
if (make_controller(path, 0755) < 0) { \
|
if (make_controller(path, 0755) < 0) { \
|
||||||
fprintf(stderr, "Cannot initialize %s\n", path); \
|
fprintf(stderr, "Cannot initialize %s\n", path); \
|
||||||
|
free(path); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
|
free(path); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
MAKE_CONTROLLER("cpu");
|
MAKE_CONTROLLER("cpu");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user