]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: Revert zeroing count of allocated items if VIR_REALLOC_N fails
authorPeter Krempa <pkrempa@redhat.com>
Thu, 27 Oct 2011 08:24:30 +0000 (10:24 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 27 Oct 2011 08:32:21 +0000 (10:32 +0200)
Previous commit clears number of items alocated in lxcSetupLoopDevices
if VIR_REALLOC_N fails. In that case, the pointer is not NULL, and
causes leaking FDs that have been allocated.

 *  src/lxc/lxc_controller.c: revert zeroing array size

src/lxc/lxc_controller.c

index 7603bc7e892aac87e0544bf741e0470979e5300d..024756d4a902f83921aff96aaf9eb6ee5f98c002 100644 (file)
@@ -208,7 +208,6 @@ static int lxcSetupLoopDevices(virDomainDefPtr def, size_t *nloopDevs, int **loo
 
         VIR_DEBUG("Saving loop fd %d", fd);
         if (VIR_REALLOC_N(*loopDevs, *nloopDevs+1) < 0) {
-            *nloopDevs = 0;
             VIR_FORCE_CLOSE(fd);
             virReportOOMError();
             goto cleanup;