diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 88fb8b5223..3427c2e446 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -898,7 +898,7 @@ storageBackendCreateQemuImgSetBacking(virStoragePoolObjPtr pool,
* validation.
*/
if (*(info->backingPath) != '/')
- virAsprintf(&absolutePath, "%s/%s", def->target.path, info->backingPath);
+ absolutePath = g_strdup_printf("%s/%s", def->target.path, info->backingPath);
accessRetCode = access(absolutePath ? absolutePath :
info->backingPath, R_OK);
if (accessRetCode != 0) {
@@ -1140,7 +1140,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
_("path to secret data file is required"));
goto error;
}
- virAsprintf(&info.secretAlias, "%s_encrypt0", vol->name);
+ info.secretAlias = g_strdup_printf("%s_encrypt0", vol->name);
if (storageBackendCreateQemuImgSecretObject(cmd, secretPath,
info.secretAlias) < 0)
goto error;
@@ -1153,7 +1153,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virStoragePoolObjPtr pool,
_("path to inputvol secret data file is required"));
goto error;
}
- virAsprintf(&inputSecretAlias, "%s_encrypt0", inputvol->name);
+ inputSecretAlias = g_strdup_printf("%s_encrypt0", inputvol->name);
if (storageBackendCreateQemuImgSecretObject(cmd, inputSecretPath,
inputSecretAlias) < 0)
goto error;
@@ -1678,10 +1678,10 @@ storageBackendIsPloopDir(char *path)
g_autofree char *root = NULL;
g_autofree char *desc = NULL;
- virAsprintf(&root, "%s/root.hds", path);
+ root = g_strdup_printf("%s/root.hds", path);
if (!virFileExists(root))
return false;
- virAsprintf(&desc, "%s/DiskDescriptor.xml", path);
+ desc = g_strdup_printf("%s/DiskDescriptor.xml", path);
if (!virFileExists(desc))
return false;
@@ -1699,7 +1699,7 @@ storageBackendRedoPloopUpdate(virStorageSourcePtr target, struct stat *sb,
{
g_autofree char *path = NULL;
- virAsprintf(&path, "%s/root.hds", target->path);
+ path = g_strdup_printf("%s/root.hds", target->path);
VIR_FORCE_CLOSE(*fd);
if ((*fd = virStorageBackendVolOpen(path, sb, flags)) < 0)
return -1;
@@ -1949,7 +1949,7 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
*/
retry:
while ((direrr = virDirRead(dh, &dent, NULL)) > 0) {
- virAsprintf(&stablepath, "%s/%s", def->target.path, dent->d_name);
+ stablepath = g_strdup_printf("%s/%s", def->target.path, dent->d_name);
if (virFileLinkPointsTo(stablepath, devpath)) {
VIR_DIR_CLOSE(dh);
@@ -2045,7 +2045,7 @@ virStorageBackendVolCreateLocal(virStoragePoolObjPtr pool,
}
VIR_FREE(vol->target.path);
- virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name);
+ vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name);
if (virFileExists(vol->target.path)) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -2282,7 +2282,7 @@ storageBackendResizeQemuImg(virStoragePoolObjPtr pool,
storageBackendCreateQemuImgSecretPath(pool, vol)))
goto cleanup;
- virAsprintf(&secretAlias, "%s_encrypt0", vol->name);
+ secretAlias = g_strdup_printf("%s_encrypt0", vol->name);
}
/* Round capacity as qemu-img resize errors out on sizes which are not
@@ -2419,7 +2419,7 @@ virStorageBackendVolUploadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
return -1;
}
- virAsprintf(&path, "%s/root.hds", vol->target.path);
+ path = g_strdup_printf("%s/root.hds", vol->target.path);
target_path = path;
}
@@ -2453,7 +2453,7 @@ virStorageBackendVolDownloadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
" will be lost"));
return -1;
}
- virAsprintf(&path, "%s/root.hds", vol->target.path);
+ path = g_strdup_printf("%s/root.hds", vol->target.path);
target_path = path;
}
@@ -2665,9 +2665,9 @@ storageBackendVolWipePloop(virStorageVolDefPtr vol,
return -1;
}
- virAsprintf(&target_path, "%s/root.hds", vol->target.path);
+ target_path = g_strdup_printf("%s/root.hds", vol->target.path);
- virAsprintf(&disk_desc, "%s/DiskDescriptor.xml", vol->target.path);
+ disk_desc = g_strdup_printf("%s/DiskDescriptor.xml", vol->target.path);
if (storageBackendVolWipeLocalFile(target_path, algorithm,
vol->target.allocation, false) < 0)
@@ -3525,7 +3525,7 @@ virStorageBackendRefreshLocal(virStoragePoolObjPtr pool)
vol->name = g_strdup(ent->d_name);
vol->type = VIR_STORAGE_VOL_FILE;
- virAsprintf(&vol->target.path, "%s/%s", def->target.path, vol->name);
+ vol->target.path = g_strdup_printf("%s/%s", def->target.path, vol->name);
vol->key = g_strdup(vol->target.path);
@@ -3666,9 +3666,9 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
* in the volume name. We only need uniqueness per-pool, so
* just leave 'host' out
*/
- virAsprintf(&(vol->name), "unit:%u:%u:%u", bus, target, lun);
+ (vol->name) = g_strdup_printf("unit:%u:%u:%u", bus, target, lun);