]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage: Fix error path in virStorageBackendSheepdogRefreshVol
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 11:30:35 +0000 (06:30 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 12 Feb 2019 13:51:23 +0000 (08:51 -0500)
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 <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/storage/storage_backend_sheepdog.c

index 9ab318bb4db57b493c8e4742e625c903aeb8233b..99d7d1d5e060040cb3091dee3b005df621c89f6a 100644 (file)
@@ -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));