]> Git Repo - qemu.git/commitdiff
9pfs: adjust the order of resource cleanup in device unrealize
authorLi Qiang <[email protected]>
Wed, 23 Nov 2016 12:53:34 +0000 (13:53 +0100)
committerGreg Kurz <[email protected]>
Wed, 23 Nov 2016 12:53:34 +0000 (13:53 +0100)
Unrealize should undo things that were set during realize in
reverse order. So should do in the error path in realize.

Signed-off-by: Li Qiang <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Signed-off-by: Greg Kurz <[email protected]>
hw/9pfs/9p.c

index aea7e9d392061edbea2b4375d879ed5a123ea0a0..087b5c98eec1bd475eba39003f3c86dfe4e8a2f2 100644 (file)
@@ -3521,8 +3521,8 @@ int v9fs_device_realize_common(V9fsState *s, Error **errp)
     rc = 0;
 out:
     if (rc) {
-        g_free(s->ctx.fs_root);
         g_free(s->tag);
+        g_free(s->ctx.fs_root);
         v9fs_path_free(&path);
     }
     return rc;
@@ -3530,8 +3530,8 @@ out:
 
 void v9fs_device_unrealize_common(V9fsState *s, Error **errp)
 {
-    g_free(s->ctx.fs_root);
     g_free(s->tag);
+    g_free(s->ctx.fs_root);
 }
 
 typedef struct VirtfsCoResetData {
This page took 0.030017 seconds and 4 git commands to generate.