qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snapshot(


From: Eric Blake
Subject: [Qemu-devel] [PATCH v3 10/13] block: Simplify bdrv_append_temp_snapshot() logic
Date: Wed, 5 Apr 2017 14:47:38 -0500

Noticed while checking Coccinelle results. Naming a label 'out:'
when it is only used on error paths is weird; meanwhile we know
that snapshot_options is NULL on success and that QDECREF(NULL)
is safe.  So merge the two exit paths into one.

Signed-off-by: Eric Blake <address@hidden>
---
 block.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/block.c b/block.c
index 9b87bf6..a13625f 100644
--- a/block.c
+++ b/block.c
@@ -2209,13 +2209,10 @@ static BlockDriverState 
*bdrv_append_temp_snapshot(BlockDriverState *bs,
         goto out;
     }

+out:
+    QDECREF(snapshot_options);
     g_free(tmp_filename);
     return bs_snapshot;
-
-out:
-    QDECREF(snapshot_options);
-    g_free(tmp_filename);
-    return NULL;
 }

 /*
-- 
2.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]