dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0025-rbd-always-set-out-parameter-in-qemu_rbd_snap_list.patch

Justin M. Forbes 45e84a
From e47c212cb5af148ab6d9dcf49bc0e054fe9c2e1d Mon Sep 17 00:00:00 2001
Justin M. Forbes 45e84a
From: Josh Durgin <josh.durgin@dreamhost.com>
Justin M. Forbes 45e84a
Date: Tue, 6 Dec 2011 17:05:10 -0800
Justin M. Forbes 45e84a
Subject: [PATCH 25/25] rbd: always set out parameter in qemu_rbd_snap_list
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
The caller expects psn_tab to be NULL when there are no snapshots or
Justin M. Forbes 45e84a
an error occurs. This results in calling g_free on an invalid address.
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
Reported-by: Oliver Francke <Oliver@filoo.de>
Justin M. Forbes 45e84a
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Justin M. Forbes 45e84a
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Justin M. Forbes 45e84a
---
Justin M. Forbes 45e84a
 block/rbd.c |    3 ++-
Justin M. Forbes 45e84a
 1 files changed, 2 insertions(+), 1 deletions(-)
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
diff --git a/block/rbd.c b/block/rbd.c
Justin M. Forbes 45e84a
index 9088c52..54a6961 100644
Justin M. Forbes 45e84a
--- a/block/rbd.c
Justin M. Forbes 45e84a
+++ b/block/rbd.c
Justin M. Forbes 45e84a
@@ -808,7 +808,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
Justin M. Forbes 45e84a
     } while (snap_count == -ERANGE);
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
     if (snap_count <= 0) {
Justin M. Forbes 45e84a
-        return snap_count;
Justin M. Forbes 45e84a
+        goto done;
Justin M. Forbes 45e84a
     }
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
     sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo));
Justin M. Forbes 45e84a
@@ -827,6 +827,7 @@ static int qemu_rbd_snap_list(BlockDriverState *bs,
Justin M. Forbes 45e84a
     }
Justin M. Forbes 45e84a
     rbd_snap_list_end(snaps);
Justin M. Forbes 45e84a
Justin M. Forbes 45e84a
+ done:
Justin M. Forbes 45e84a
     *psn_tab = sn_tab;
Justin M. Forbes 45e84a
     return snap_count;
Justin M. Forbes 45e84a
 }
Justin M. Forbes 45e84a
-- 
Justin M. Forbes 45e84a
1.7.7.5
Justin M. Forbes 45e84a