]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: avoid NULL dereference upon getmntent failure
authorJim Meyering <meyering@redhat.com>
Wed, 2 Sep 2009 07:58:50 +0000 (09:58 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 3 Sep 2009 16:04:23 +0000 (18:04 +0200)
* src/lxc_container.c (lxcContainerUnmountOldFS): Don't pass
a NULL pointer to qsort.

src/lxc_container.c

index 950dd502153db7474f94f324179f487900a5f77c..20738648a5597c78e3f305a3e10b0205ecdf385c 100644 (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]);