qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 08/14] rbd: always set out parameter in qemu_rbd_sna


From: Kevin Wolf
Subject: [Qemu-devel] [PATCH 08/14] rbd: always set out parameter in qemu_rbd_snap_list
Date: Thu, 15 Dec 2011 15:09:23 +0100

From: Josh Durgin <address@hidden>

The caller expects psn_tab to be NULL when there are no snapshots or
an error occurs. This results in calling g_free on an invalid address.

Reported-by: Oliver Francke <address@hidden>
Signed-off-by: Josh Durgin <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
 block/rbd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index 312584a..7a2384c 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -805,7 +805,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
     } while (snap_count == -ERANGE);
 
     if (snap_count <= 0) {
-        return snap_count;
+        goto done;
     }
 
     sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo));
@@ -824,6 +824,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
     }
     rbd_snap_list_end(snaps);
 
+ done:
     *psn_tab = sn_tab;
     return snap_count;
 }
-- 
1.7.6.4




reply via email to

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