提交 dc03ae2c 编写于 作者: J Jim Meyering

vboxDomainDumpXML: avoid a leak on OOM error path

* src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free vboxCallback buffer
upon OOM.
上级 e977f471
...@@ -5276,10 +5276,11 @@ static nsresult vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid, ...@@ -5276,10 +5276,11 @@ static nsresult vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid,
static IVirtualBoxCallback *vboxAllocCallbackObj(void) { static IVirtualBoxCallback *vboxAllocCallbackObj(void) {
IVirtualBoxCallback *vboxCallback = NULL; IVirtualBoxCallback *vboxCallback = NULL;
/* Allocate, Initialize and return a validi /* Allocate, Initialize and return a valid
* IVirtualBoxCallback object here * IVirtualBoxCallback object here
*/ */
if ((VIR_ALLOC(vboxCallback) < 0) || (VIR_ALLOC(vboxCallback->vtbl) < 0)) { if ((VIR_ALLOC(vboxCallback) < 0) || (VIR_ALLOC(vboxCallback->vtbl) < 0)) {
VIR_FREE(vboxCallback);
virReportOOMError(); virReportOOMError();
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册