[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapsho
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create() |
Date: |
Mon, 2 Jun 2014 15:56:44 +0200 |
From: Markus Armbruster <address@hidden>
Has always been leaky. Spotted by Coverity.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/sheepdog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 39f7461..4ecbf5f 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -2176,6 +2176,7 @@ static int sd_snapshot_create(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info)
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
/* we don't need to update entire object */
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
+ inode = g_malloc(datalen);
/* refresh inode. */
fd = connect_to_sdog(s, &local_err);
@@ -2202,8 +2203,6 @@ static int sd_snapshot_create(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info)
goto cleanup;
}
- inode = (SheepdogInode *)g_malloc(datalen);
-
ret = read_object(fd, (char *)inode, vid_to_vdi_oid(new_vid),
s->inode.nr_copies, datalen, 0, s->cache_flags);
@@ -2217,6 +2216,7 @@ static int sd_snapshot_create(BlockDriverState *bs,
QEMUSnapshotInfo *sn_info)
s->inode.name, s->inode.snap_id, s->inode.vdi_id);
cleanup:
+ g_free(inode);
closesocket(fd);
return ret;
}
--
1.8.3.1
- [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths, (continued)
- [Qemu-devel] [PULL 03/17] qcow2: Plug memory leak on qcow2_invalidate_cache() error paths, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 04/17] block: Plug memory leak on brv_open_image() error path, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 05/17] qemu-io: Support multiple -o in open command, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 06/17] qemu-io: Plug memory leak in open command, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 08/17] blockdev: Plug memory leak in blockdev_init(), Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 07/17] qemu-io: Don't print NULL when open without non-option arg fails, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 10/17] block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERROR, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 11/17] block/vvfat: Plug memory leak in check_directory_consistency(), Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 09/17] blockdev: Plug memory leak in drive_init(), Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 12/17] block/vvfat: Plug memory leak in read_directory(), Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 13/17] block/sheepdog: Plug memory leak in sd_snapshot_create(),
Kevin Wolf <=
- [Qemu-devel] [PULL 14/17] qemu-img: Plug memory leak in convert command, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 15/17] block/raw-posix.c: Avoid nonstandard LONG_LONG_MAX, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 16/17] vmdk: Fix local_err in vmdk_create, Kevin Wolf, 2014/06/02
- [Qemu-devel] [PULL 17/17] qemu-img: Report error even with --oformat=json, Kevin Wolf, 2014/06/02
- Re: [Qemu-devel] [PULL 00/17] Block patches, Peter Maydell, 2014/06/02