[Libguestfs] [PATCH nbdkit v3 3/4] tests/test-lang-plugins.c: Free data and reuse variable.

Richard W.M. Jones rjones at redhat.com
Wed Nov 14 14:27:36 UTC 2018


---
 tests/test-lang-plugins.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/test-lang-plugins.c b/tests/test-lang-plugins.c
index 69471c4..46b0563 100644
--- a/tests/test-lang-plugins.c
+++ b/tests/test-lang-plugins.c
@@ -112,6 +112,7 @@ main (int argc, char *argv[])
              program_name, filename, data, content);
     exit (EXIT_FAILURE);
   }
+  free (data);
 
   /* Run sync to test flush path. */
   if (guestfs_sync (g) == -1)
@@ -130,8 +131,8 @@ main (int argc, char *argv[])
   if (guestfs_umount (g, "/") == -1)
     exit (EXIT_FAILURE);
   const char *cmd[] = { "fallocate", "-nzl", "64k", "/dev/sda", NULL };
-  char *s = guestfs_debug (g, "sh", (char **) cmd);
-  free (s);
+  data = guestfs_debug (g, "sh", (char **) cmd);
+  free (data);
 
   if (guestfs_shutdown (g) == -1)
     exit (EXIT_FAILURE);
-- 
2.19.0.rc0




More information about the Libguestfs mailing list