qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] rbd: fix leak in failure path
@ 2011-08-23 16:28 Sage Weil
  2011-08-23 16:28 ` [Qemu-devel] [PATCH 2/3] rbd: allow client id to be specified in config string Sage Weil
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Sage Weil @ 2011-08-23 16:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sage Weil

Fix leak of s->snap when rados_create fails.

Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Sage Weil <sage@newdream.net>
---
 block/rbd.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index d5659cd..52b79fa 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -393,10 +393,6 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
                            conf, sizeof(conf)) < 0) {
         return -EINVAL;
     }
-    s->snap = NULL;
-    if (snap_buf[0] != '\0') {
-        s->snap = qemu_strdup(snap_buf);
-    }
 
     r = rados_create(&s->cluster, NULL);
     if (r < 0) {
@@ -404,6 +400,11 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
         return r;
     }
 
+    s->snap = NULL;
+    if (snap_buf[0] != '\0') {
+        s->snap = qemu_strdup(snap_buf);
+    }
+
     if (strstr(conf, "conf=") == NULL) {
         r = rados_conf_read_file(s->cluster, NULL);
         if (r < 0) {
-- 
1.7.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-09-05 12:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 16:28 [Qemu-devel] [PATCH 1/3] rbd: fix leak in failure path Sage Weil
2011-08-23 16:28 ` [Qemu-devel] [PATCH 2/3] rbd: allow client id to be specified in config string Sage Weil
2011-09-02 14:12   ` Stefan Hajnoczi
2011-08-23 16:28 ` [Qemu-devel] [PATCH 3/3] rbd: clean up, fix style Sage Weil
2011-09-02 14:14   ` Stefan Hajnoczi
2011-09-02 14:10 ` [Qemu-devel] [PATCH 1/3] rbd: fix leak in failure path Stefan Hajnoczi
2011-09-03 22:04   ` [Qemu-devel] [PATCH v2] rbd: fix leak in qemu_rbd_open failure paths Sage Weil
2011-09-04 11:24     ` Stefan Hajnoczi
2011-09-04 16:18       ` Sage Weil
2011-09-04 16:19       ` [Qemu-devel] [PATCH v3] " Sage Weil
2011-09-04 18:20         ` Stefan Hajnoczi
2011-09-05 12:32         ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).