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

[libvirt] [PATCH] vboxDomainDumpXML: avoid a leak on OOM error path



Yet another...

>From 05e87caf9da26f9038935d7e54b6038b9362875b Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Mon, 15 Feb 2010 20:09:55 +0100
Subject: [PATCH] vboxDomainDumpXML: avoid a leak on OOM error path

* src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free vboxCallback buffer
upon OOM.
---
 src/vbox/vbox_tmpl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index d1a701e..8a9af52 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -5276,10 +5276,11 @@ static nsresult vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid,
 static IVirtualBoxCallback *vboxAllocCallbackObj(void) {
     IVirtualBoxCallback *vboxCallback = NULL;

-    /* Allocate, Initialize and return a validi
+    /* Allocate, Initialize and return a valid
      * IVirtualBoxCallback object here
      */
     if ((VIR_ALLOC(vboxCallback) < 0) || (VIR_ALLOC(vboxCallback->vtbl) < 0)) {
+        VIR_FREE(vboxCallback);
         virReportOOMError();
         return NULL;
     }
--
1.7.0.181.g41533


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