From 8a69cbc1813c7fd716ce1d6c146136fa36083aaf Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Tue, 12 Feb 2019 06:30:35 -0500 Subject: [PATCH] storage: Fix error path in virStorageBackendSheepdogRefreshVol MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/storage/storage_backend_sheepdog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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));