From: Jim Fehlig Date: Thu, 15 Aug 2013 16:03:17 +0000 (-0600) Subject: libxl: unref DomainObjPrivate on error path X-Git-Tag: CVE-2013-5651~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0c513a6a0df25d5b8aacaf3d7395e829cb2e358;p=thirdparty%2Flibvirt.git libxl: unref DomainObjPrivate on error path There is a potential leak of a newly created libxlDomainObjPrivate when subsequent allocation of the object's chrdev field fails. Unref the object on such an error so that it is properly disposed. --- diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index ddd794304f..f09ad6142c 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -454,8 +454,10 @@ libxlDomainObjPrivateAlloc(void) if (!(priv = virObjectLockableNew(libxlDomainObjPrivateClass))) return NULL; - if (!(priv->devs = virChrdevAlloc())) + if (!(priv->devs = virChrdevAlloc())) { + virObjectUnref(priv); return NULL; + } return priv; }