[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH 13/14] block/sheepdog: Plug memory
From: |
Benoît Canet |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH 13/14] block/sheepdog: Plug memory leak in sd_snapshot_create() |
Date: |
Tue, 27 May 2014 13:03:38 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
The Monday 26 May 2014 à 19:37:14 (+0200), Markus Armbruster wrote :
> Has always been leaky. Spotted by Coverity.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> block/sheepdog.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 2c3fb01..9a9a307 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -2149,6 +2149,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);
> @@ -2171,8 +2172,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);
>
> @@ -2186,6 +2185,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.9.3
>
>
Reviewed-by: Benoit Canet <address@hidden>
- Re: [Qemu-stable] [Qemu-devel] [PATCH 09/14] blockdev: Plug memory leak in drive_init(), (continued)
[Qemu-stable] [PATCH 06/14] qemu-io: Plug memory leak in open command, Markus Armbruster, 2014/05/26
[Qemu-stable] [PATCH 08/14] blockdev: Plug memory leak in blockdev_init(), Markus Armbruster, 2014/05/26
[Qemu-stable] [PATCH 13/14] block/sheepdog: Plug memory leak in sd_snapshot_create(), Markus Armbruster, 2014/05/26
- Re: [Qemu-stable] [Qemu-devel] [PATCH 13/14] block/sheepdog: Plug memory leak in sd_snapshot_create(),
Benoît Canet <=
[Qemu-stable] [PATCH 12/14] block/vvfat: Plug memory leak in read_directory(), Markus Armbruster, 2014/05/26
[Qemu-stable] [PATCH 11/14] block/vvfat: Plug memory leak in check_directory_consistency(), Markus Armbruster, 2014/05/26
[Qemu-stable] [PATCH 01/14] qemu-img: Plug memory leak on block option help error path, Markus Armbruster, 2014/05/26