virReportOOMError();
goto cleanup;
}
- if (!(mounts[nmounts++] = strdup(mntent.mnt_dir))) {
+ if (!(mounts[nmounts] = strdup(mntent.mnt_dir))) {
virReportOOMError();
goto cleanup;
}
+ nmounts++;
VIR_DEBUG("Grabbed %s", mntent.mnt_dir);
}
qsort(mounts, nmounts, sizeof(mounts[0]),
lxcContainerChildMountSort);
- *mountsret = mounts;
- *nmountsret = nmounts;
ret = 0;
-
cleanup:
+ *mountsret = mounts;
+ *nmountsret = nmounts;
endmntent(procmnt);
return ret;
}
VIR_DEBUG("Unmount subtreee from %s", prefix);
if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0)
- return -1;
+ goto cleanup;
for (i = 0 ; i < nmounts ; i++) {
VIR_DEBUG("Umount %s", mounts[i]);
if (umount(mounts[i]) < 0) {