lxc: avoid NULL dereference upon getmntent failure

* src/lxc_container.c (lxcContainerUnmountOldFS): Don't pass
a NULL pointer to qsort.
This commit is contained in:
Jim Meyering 2009-09-02 09:58:50 +02:00
parent cff257f584
commit e4ac19a87a

View File

@ -546,8 +546,9 @@ static int lxcContainerUnmountOldFS(void)
}
endmntent(procmnt);
qsort(mounts, nmounts, sizeof(mounts[0]),
lxcContainerChildMountSort);
if (mounts)
qsort(mounts, nmounts, sizeof(mounts[0]),
lxcContainerChildMountSort);
for (i = 0 ; i < nmounts ; i++) {
VIR_DEBUG("Umount %s", mounts[i]);