storage: fix crash when listing volumes or undefining a pool

The commit cad3cf9a95 introduced a crash
due to wrong order of parameters being passed to the function.  When
deleting an element, the function decreased the iterator instead of
count and if listing volumes after that (or undefining the pool, NULL
was being dereferenced.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-01-09 16:28:30 +01:00
parent 4f588a1b46
commit 2a6395aa1d

View File

@ -1566,7 +1566,7 @@ storageVolDelete(virStorageVolPtr obj,
vol->name, pool->def->name);
virStorageVolDefFree(vol);
VIR_DELETE_ELEMENT(pool->volumes.objs, pool->volumes.count, i);
VIR_DELETE_ELEMENT(pool->volumes.objs, i, pool->volumes.count);
break;
}
}