Skip to contentSkip to conversation

9pfs: adjust the order of resource cleanup in device unrealize

PATCH In review Li Qiang 2 participants 2 messages Nov 15, 2016

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 9pfs: adjust the order of resource cleanup in device unrealize

From: Li Qiang <[email protected]>

Unrealize should undo things that were set during realize in reverse order. This is what this patch does.

---
 hw/9pfs/9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p.c +1 -1
index aea7e9d..f7e14ac 100644
@@ -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 {
Signature · 1 line
1.8.3.1
#1 lore raw

Hi Li,

Please incorporate this patch in your cleanup series since it depends on it.

Quoted 5 lines · On Mon, 14 Nov 2016 20:38:57 -0500 Li Qiang <[email protected]> wrote:

From: Li Qiang <[email protected]>

Unrealize should undo things that were set during realize in reverse order. This is what this patch does.

So should do the error path in realize actually. :)

Quoted 19 lines
---
 hw/9pfs/9p.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/9pfs/9p.c +1 -1
index aea7e9d..f7e14ac 100644
@@ -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 {