Skip to content

Commit

Permalink
vmdk: fix buf leak in vmdk_parse_extents()
Browse files Browse the repository at this point in the history
vmdk_open_sparse() does not take ownership of buf so the caller always
needs to free it.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
  • Loading branch information
stefanhaRH committed Sep 8, 2014
1 parent ff74f33 commit b6b1d31
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/vmdk.c
Expand Up @@ -846,8 +846,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
} else {
ret = vmdk_open_sparse(bs, extent_file, bs->open_flags, buf, errp);
}
g_free(buf);
if (ret) {
g_free(buf);
bdrv_unref(extent_file);
return ret;
}
Expand Down

0 comments on commit b6b1d31

Please sign in to comment.