[libvirt] report OOM in two places in node_device_driver.c
Daniel Veillard
veillard at redhat.com
Thu Nov 19 14:46:01 UTC 2009
On Tue, Nov 17, 2009 at 12:02:33PM +0100, Daniel Veillard wrote:
> On Mon, Nov 16, 2009 at 03:11:01PM -0500, Dave Allan wrote:
> > I noticed that there are two places in node_device_driver.c in which we
> > don't call virReportOOMError after strdup failure. The attached small
> > patch adds the two calls.
> >
> > Dave
>
> > diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
> > index cddd994..b474d43 100644
> > --- a/src/node_device/node_device_driver.c
> > +++ b/src/node_device/node_device_driver.c
> > @@ -175,6 +175,7 @@ nodeListDevices(virConnectPtr conn,
> > virNodeDeviceHasCap(driver->devs.objs[i], cap)) {
> > if ((names[ndevs++] = strdup(driver->devs.objs[i]->def->name)) == NULL) {
> > virNodeDeviceObjUnlock(driver->devs.objs[i]);
> > + virReportOOMError(conn);
> > goto failure;
> > }
> > }
> > @@ -379,8 +380,10 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames)
> >
> > for (caps = obj->def->caps; caps && ncaps < maxnames; caps = caps->next) {
> > names[ncaps] = strdup(virNodeDevCapTypeToString(caps->type));
> > - if (names[ncaps++] == NULL)
> > + if (names[ncaps++] == NULL) {
> > + virReportOOMError(dev->conn);
> > goto cleanup;
> > + }
> > }
> > ret = ncaps;
> >
>
> ACK !
Okay, I pushed it !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list