In this case we reference def with is NULL. O.k. to apply?
Cheers,
 -- Guido
>From ff82eb24e50b4f80769bd932ca739e8a2539edb4 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org>
Date: Mon, 4 May 2009 21:29:15 +0200
Subject: [PATCH 1/2] 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);
-- 
1.6.2.4

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to