[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 1/5] block: allow bdrv_unref() to be passed NULL
From: |
Jeff Cody |
Subject: |
[Qemu-devel] [PATCH v3 1/5] block: allow bdrv_unref() to be passed NULL pointers |
Date: |
Wed, 23 Jul 2014 17:22:57 -0400 |
If bdrv_unref() is passed a NULL BDS pointer, it is safe to
exit with no operation. This will allow cleanup code to blindly
call bdrv_unref() on a BDS that has been initialized to NULL.
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
---
block.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block.c b/block.c
index 23f366d..f79efc8 100644
--- a/block.c
+++ b/block.c
@@ -5385,6 +5385,9 @@ void bdrv_ref(BlockDriverState *bs)
* deleted. */
void bdrv_unref(BlockDriverState *bs)
{
+ if (!bs) {
+ return;
+ }
assert(bs->refcnt > 0);
if (--bs->refcnt == 0) {
bdrv_delete(bs);
--
1.9.3
- [Qemu-devel] [PATCH v3 0/5] Allow VPC and VDI to be created over protocols, Jeff Cody, 2014/07/23
- [Qemu-devel] [PATCH v3 1/5] block: allow bdrv_unref() to be passed NULL pointers,
Jeff Cody <=
- [Qemu-devel] [PATCH v3 2/5] block: vdi - use block layer ops in vdi_create, instead of posix calls, Jeff Cody, 2014/07/23
- [Qemu-devel] [PATCH v3 4/5] block: vpc - use block layer ops in vpc_create, instead of posix calls, Jeff Cody, 2014/07/23
- [Qemu-devel] [PATCH v3 5/5] block: iotest - update 084 to test static VDI image creation, Jeff Cody, 2014/07/23
- [Qemu-devel] [PATCH v3 3/5] block: use the standard 'ret' instead of 'result', Jeff Cody, 2014/07/23