From: John Ferlan Date: Tue, 12 Feb 2019 11:30:35 +0000 (-0500) Subject: storage: Fix error path in virStorageBackendSheepdogRefreshVol X-Git-Tag: v5.1.0-rc1~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a69cbc1813c7fd716ce1d6c146136fa36083aaf;p=thirdparty%2Flibvirt.git storage: Fix error path in virStorageBackendSheepdogRefreshVol If the virAsprintf of the vol->key fails, then we would erroneously return the '0' from the @ret from virStorageBackendSheepdogParseVdiList. So in this error path case, let's set ret = -1. Signed-off-by: John Ferlan Reviewed-by: Ján Tomko --- diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index 9ab318bb4d..99d7d1d5e0 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -359,9 +359,10 @@ virStorageBackendSheepdogRefreshVol(virStoragePoolObjPtr pool, vol->type = VIR_STORAGE_VOL_NETWORK; VIR_FREE(vol->key); - if (virAsprintf(&vol->key, "%s/%s", - def->source.name, vol->name) < 0) + if (virAsprintf(&vol->key, "%s/%s", def->source.name, vol->name) < 0) { + ret = -1; goto cleanup; + } VIR_FREE(vol->target.path); ignore_value(VIR_STRDUP(vol->target.path, vol->name));