From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Mon, 4 May 2009 21:29:15 +0200
Subject: [PATCH] don't crash with def == NULL

happens when calling libvirt_lxc without arguments
---
 src/lxc_controller.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/lxc_controller.c b/src/lxc_controller.c
index 3f9add2..e0fb05d 100644
--- a/src/lxc_controller.c
+++ b/src/lxc_controller.c
@@ -745,7 +745,8 @@ int main(int argc, char *argv[])
 
 
 cleanup:
-    virFileDeletePid(LXC_STATE_DIR, def->name);
+    if (def)
+        virFileDeletePid(LXC_STATE_DIR, def->name);
     lxcControllerCleanupInterfaces(nveths, veths);
     unlink(sockpath);
     VIR_FREE(sockpath);
-- 
