From: Peter Krempa Date: Mon, 26 Nov 2012 11:13:56 +0000 (+0100) Subject: lxc: Avoid segfault of libvirt_lxc helper on early cleanup paths X-Git-Tag: v0.10.2.2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fac1a19dfca0a8bc2cb618e0b96119fd3dd07e55;p=thirdparty%2Flibvirt.git lxc: Avoid segfault of libvirt_lxc helper on early cleanup paths 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) --- diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 6ff2e4643d..2807f3559a 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -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);