]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: fix use of aodev->dev after free
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 21 Nov 2013 16:18:00 +0000 (17:18 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 21 Nov 2013 18:33:07 +0000 (18:33 +0000)
Coverity-ID: 1130521
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl.c

index 4292c7801039cf537ddde376ab4ac4196d826746..ed3293127d8600e20a56ae9d28a170a0d31a7743 100644 (file)
@@ -3596,14 +3596,14 @@ static void device_complete(libxl__egc *egc, libxl__ao_device *aodev)
 {
     STATE_AO_GC(aodev->ao);
 
-    if (aodev->action == LIBXL__DEVICE_ACTION_REMOVE)
-        free(aodev->dev);
-
     LOG(DEBUG, "device %s %s %s",
                libxl__device_backend_path(gc, aodev->dev),
                libxl__device_action_to_string(aodev->action),
                aodev->rc ? "failed" : "succeed");
 
+    if (aodev->action == LIBXL__DEVICE_ACTION_REMOVE)
+        free(aodev->dev);
+
     libxl__nested_ao_free(aodev->ao);
 }