]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: fix crash when listing volumes or undefining a pool
authorMartin Kletzander <mkletzan@redhat.com>
Thu, 9 Jan 2014 15:28:30 +0000 (16:28 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Thu, 9 Jan 2014 15:48:11 +0000 (16:48 +0100)
The commit cad3cf9a951d26da9d2ee0f5b52fb1a2dbb74af1 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>
src/storage/storage_driver.c

index aaa0f0286d475e7d8171dc01d0a28f69f5c198db..85fc0f2522dea89ead9e2091d4a8b32d9d1384d4 100644 (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;
         }
     }