summaryrefslogtreecommitdiffstats
path: root/test-tool
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-11-24 15:49:49 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-11-24 15:51:16 +0000
commitbfc0a5f58d3cb6faad5a44bed392f33190e62246 (patch)
tree7adc13f3789c8547b11ff3ffa96fa883d78525f3 /test-tool
parentcd3d28491dd19d25a6c04a8bc6a7ec94bded413b (diff)
downloadlibguestfs-bfc0a5f58d3cb6faad5a44bed392f33190e62246.tar.gz
libguestfs-bfc0a5f58d3cb6faad5a44bed392f33190e62246.tar.xz
libguestfs-bfc0a5f58d3cb6faad5a44bed392f33190e62246.zip
test-tool: Fix multiple memory leaks found by valgrind.
Diffstat (limited to 'test-tool')
-rw-r--r--test-tool/test-tool.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
index 27d66f78..a49a4593 100644
--- a/test-tool/test-tool.c
+++ b/test-tool/test-tool.c
@@ -111,6 +111,7 @@ main (int argc, char *argv[])
int option_index;
int i;
struct guestfs_version *vers;
+ char *p;
for (;;) {
c = getopt_long (argc, argv, options, long_options, &option_index);
@@ -194,8 +195,9 @@ main (int argc, char *argv[])
guestfs_free_version (vers);
printf ("guestfs_get_append: %s\n", guestfs_get_append (g) ? : "(null)");
- printf ("guestfs_get_attach_method: %s\n",
- guestfs_get_attach_method (g) ? : "(null)");
+ p = guestfs_get_attach_method (g);
+ printf ("guestfs_get_attach_method: %s\n", p ? : "(null)");
+ free (p);
printf ("guestfs_get_autosync: %d\n", guestfs_get_autosync (g));
printf ("guestfs_get_direct: %d\n", guestfs_get_direct (g));
printf ("guestfs_get_memsize: %d\n", guestfs_get_memsize (g));
@@ -203,8 +205,7 @@ main (int argc, char *argv[])
printf ("guestfs_get_path: %s\n", guestfs_get_path (g));
printf ("guestfs_get_pgroup: %d\n", guestfs_get_pgroup (g));
printf ("guestfs_get_qemu: %s\n", guestfs_get_qemu (g));
- printf ("guestfs_get_recovery_proc: %d\n",
- guestfs_get_recovery_proc (g));
+ printf ("guestfs_get_recovery_proc: %d\n", guestfs_get_recovery_proc (g));
printf ("guestfs_get_selinux: %d\n", guestfs_get_selinux (g));
printf ("guestfs_get_smp: %d\n", guestfs_get_smp (g));
printf ("guestfs_get_trace: %d\n", guestfs_get_trace (g));
@@ -255,6 +256,9 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
+ /* Close the handle. */
+ guestfs_close (g);
+
/* Booted and performed some simple operations -- success! */
printf ("===== TEST FINISHED OK =====\n");
exit (EXIT_SUCCESS);