int ret = -1;
int fd = -1;
off_t end;
- virStorageFileMetadata meta;
+ virStorageFileMetadata *meta = NULL;
virDomainDiskDefPtr disk = NULL;
struct stat sb;
int i;
}
}
+ if (VIR_ALLOC(meta) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
if (virStorageFileGetMetadataFromFD(path, fd,
format,
- &meta) < 0)
+ meta) < 0)
goto cleanup;
/* Get info for normal formats */
/* If the file we probed has a capacity set, then override
* what we calculated from file/block extents */
- if (meta.capacity)
- info->capacity = meta.capacity;
+ if (meta->capacity)
+ info->capacity = meta->capacity;
/* Set default value .. */
info->allocation = info->physical;
}
cleanup:
+ virStorageFileFreeMetadata(meta);
VIR_FORCE_CLOSE(fd);
if (vm)
virDomainObjUnlock(vm);