[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 2/4] nbd: call drive_put_ref() only if dinfo exi
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [RFC PATCH 2/4] nbd: call drive_put_ref() only if dinfo exists |
Date: |
Mon, 29 Jul 2013 12:25:30 +0800 |
Signed-off-by: Fam Zheng <address@hidden>
---
blockdev-nbd.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/blockdev-nbd.c b/blockdev-nbd.c
index 95f10c8..c75df19 100644
--- a/blockdev-nbd.c
+++ b/blockdev-nbd.c
@@ -72,7 +72,10 @@ static void nbd_close_notifier(Notifier *n, void *data)
static void nbd_server_put_ref(NBDExport *exp)
{
BlockDriverState *bs = nbd_export_get_blockdev(exp);
- drive_put_ref(drive_get_by_blockdev(bs));
+ DriveInfo *dinfo = drive_get_by_blockdev(bs);
+ if (dinfo) {
+ drive_put_ref(dinfo);
+ }
}
void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
--
1.8.3.4