]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: fix double free when doing xl save
authorJuergen Gross <jgross@suse.com>
Thu, 28 Jul 2016 07:21:43 +0000 (09:21 +0200)
committerWei Liu <wei.liu2@citrix.com>
Thu, 28 Jul 2016 09:37:30 +0000 (10:37 +0100)
Commit d2412fd63b14c6c21d0a3d4367afa448425dfb8a ("libxl: move common
nic stuff into one source") introduced a double free error in libxl
which occurred during "xl save".

Correct this error.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl_nic.c

index 278285a532022a76acb91adc9cf59ee281742b2c..760ebcac7ecb299c4a0b8dd17fe7592f96399d5d 100644 (file)
@@ -3228,7 +3228,7 @@ static int libxl__device_channel_from_xenstore(libxl__gc *gc,
                                 GCSPRINTF("%s/name", libxl_path),
                                 (const char **)(&channel->name));
     if (rc) goto out;
-    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
+    rc = libxl__xs_read_checked(gc, XBT_NULL,
                                 GCSPRINTF("%s/connection", libxl_path), &tmp);
     if (rc) goto out;
     if (!strcmp(tmp, "pty")) {
index ff1834fbe36ddfad79b34534ae991ed739bd7a42..c34b7bae8b4567a8420a4ad9f6f86c63e26d9b06 100644 (file)
@@ -321,19 +321,19 @@ static int libxl__device_nic_from_xenstore(libxl__gc *gc,
         memset(nic->mac, 0, sizeof(nic->mac));
     }
 
-    rc = libxl__xs_read_checked(gc, XBT_NULL,
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/ip", libxl_path),
                                 (const char **)(&nic->ip));
     if (rc) goto out;
-    rc = libxl__xs_read_checked(gc, XBT_NULL,
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/bridge", libxl_path),
                                 (const char **)(&nic->bridge));
     if (rc) goto out;
-    rc = libxl__xs_read_checked(gc, XBT_NULL,
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/script", libxl_path),
                                 (const char **)(&nic->script));
     if (rc) goto out;
-    rc = libxl__xs_read_checked(gc, XBT_NULL,
+    rc = libxl__xs_read_checked(NOGC, XBT_NULL,
                                 GCSPRINTF("%s/forwarddev", libxl_path),
                                 (const char **)(&nic->coloft_forwarddev));
     if (rc) goto out;