lxc: Revert zeroing count of allocated items if VIR_REALLOC_N fails

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
This commit is contained in:
Peter Krempa 2011-10-27 10:24:30 +02:00
parent 838d8c1b6b
commit 95d3b4de71

View File

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