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 <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
John Ferlan 2019-02-12 06:30:35 -05:00
parent 7550480036
commit 8a69cbc181

View 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));