]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: Avoid segfault of libvirt_lxc helper on early cleanup paths
authorPeter Krempa <pkrempa@redhat.com>
Mon, 26 Nov 2012 11:13:56 +0000 (12:13 +0100)
committerCole Robinson <crobinso@redhat.com>
Sun, 9 Dec 2012 21:35:53 +0000 (16:35 -0500)
Early jumps to the cleanup label caused a crash of the libvirt_lxc
container helper as the cleanup section called
virLXCControllerDeleteInterfaces(ctrl) without checking the ctrl argument
for NULL. The argument was de-referenced soon after.

$ /usr/libexec/libvirt_lxc
/usr/libexec/libvirt_lxc: missing --name argument for configuration
Segmentation fault
(cherry picked from commit 81efb13b4a33f58c28e0e65dcc9521b983592683)

src/lxc/lxc_controller.c

index 6ff2e4643d4a3774e7bca63aebfac2b7ace0848f..2807f3559a86e44595eaacfeb433cf9d33375c0d 100644 (file)
@@ -1649,7 +1649,8 @@ int main(int argc, char *argv[])
 
 cleanup:
     virPidFileDelete(LXC_STATE_DIR, name);
-    virLXCControllerDeleteInterfaces(ctrl);
+    if (ctrl)
+        virLXCControllerDeleteInterfaces(ctrl);
     for (i = 0 ; i < nttyFDs ; i++)
         VIR_FORCE_CLOSE(ttyFDs[i]);
     VIR_FREE(ttyFDs);