From dc03ae2c6db738f65304e6a7e82675bde5b2ad6d Mon Sep 17 00:00:00 2001 From: Jim Meyering 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 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index d1a701e618..8a9af52330 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; } -- GitLab