[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu_driver.c: don't unlink(NULL) on OOM error path



Not terribly likely, but not impossible, either:

>From dc8fe76ed209d04b1e962b94b20da17a077e102f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Mon, 14 Dec 2009 16:41:11 +0100
Subject: [PATCH] qemu_driver.c: don't unlink(NULL) on OOM error path

* src/qemu/qemu_driver.c (qemudDomainMigratePrepareTunnel): Upon an
out of memory error, we would end up with unixfile==NULL and attempt
to unlink(NULL).  Skip the unlink when it's NULL.
---
 src/qemu/qemu_driver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 56bcec5..04b2511 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6903,7 +6903,8 @@ endjob:

 cleanup:
     virDomainDefFree(def);
-    unlink(unixfile);
+    if (unixfile)
+      unlink(unixfile);
     VIR_FREE(unixfile);
     if (vm)
         virDomainObjUnlock(vm);
--
1.6.6.rc2.275.g51e2d


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]