On Tue, Jan 20, 2015 at 12:31:29PM -0500, Jeff Cody wrote: > @@ -792,12 +792,11 @@ static int vmdk_parse_extents(const char *desc, > BlockDriverState *bs, > const char *p = desc; > int64_t sectors = 0; > int64_t flat_offset; > - char extent_path[PATH_MAX]; > + char *extent_path = g_malloc0(PATH_MAX);
Simpler alternative that has no risk of memory leaks: extent_path = g_malloc0(PATH_MAX); path_combine(extent_path, sizeof(extent_path), desc_file_path, fname); extent_file = NULL; ret = bdrv_open(&extent_file, extent_path, NULL, NULL, bs->open_flags | BDRV_O_PROTOCOL, NULL, errp); g_free(extent_path); if (ret) { goto exit; }
pgpUS9cSCN3Be.pgp
Description: PGP signature