int fd;
int ret = -1;
int backingFormat;
+ char *backingPath = NULL;
char *backingDirectory = NULL;
VIR_DEBUG("path=%s canonPath=%s dir=%s format=%d uid=%d gid=%d probe=%d",
if (virFindBackingFile(directory,
meta->backingStoreRaw,
&backingDirectory,
- &meta->backingStore) < 0) {
+ &backingPath) < 0) {
/* the backing file is (currently) unavailable, treat this
* file as standalone:
* backingStoreRaw is kept to mark broken image chains */
return 0;
}
} else {
- if (VIR_STRDUP(meta->backingStore, meta->backingStoreRaw) < 0)
+ if (VIR_STRDUP(backingPath, meta->backingStoreRaw) < 0)
return -1;
}
+ if (VIR_STRDUP(meta->backingStore, backingPath) < 0)
+ return -1;
+
if (backingFormat == VIR_STORAGE_FILE_AUTO && !allow_probe)
backingFormat = VIR_STORAGE_FILE_RAW;
else if (backingFormat == VIR_STORAGE_FILE_AUTO_SAFE)
backingFormat = VIR_STORAGE_FILE_AUTO;
if (VIR_ALLOC(backing) < 0 ||
virStorageFileGetMetadataRecurse(meta->backingStoreRaw,
- meta->backingStore,
+ backingPath,
backingDirectory, backingFormat,
uid, gid, allow_probe,
cycle, backing) < 0) {
meta->backingMeta = backing;
}
}
+
VIR_FREE(backingDirectory);
+ VIR_FREE(backingPath);
return ret;
}