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

Re: [PULL 13/27] hw/xen: Add xenstore operations to allow redirection to internal emulation



On Tue, 2023-04-04 at 18:45 +0100, Peter Maydell wrote:
> On Tue, 4 Apr 2023 at 18:45, David Woodhouse <dwmw2@xxxxxxxxxxxxx>
> wrote:
> > 
> > On Tue, 2023-04-04 at 18:35 +0100, Peter Maydell wrote:
> > > On Tue, 7 Mar 2023 at 18:27, David Woodhouse
> > > <dwmw2@xxxxxxxxxxxxx>
> > > wrote:
> > > > 
> > > > From: Paul Durrant <pdurrant@xxxxxxxxxx>
> > > > 
> > > > Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
> > > > Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> > > > Reviewed-by: Paul Durrant <paul@xxxxxxx>
> > > > ---
> > > 
> > > Hi; Coverity points out a memory leak in this code (CID 1508098):
> > > 
> > > > +static struct qemu_xs_handle *libxenstore_open(void)
> > > > +{
> > > > +    struct xs_handle *xsh = xs_open(0);
> > > > +    struct qemu_xs_handle *h = g_new0(struct qemu_xs_handle,
> > > > 1);
> > > 
> > > Here we allocate memory...
> > > 
> > > > +
> > > > +    if (!xsh) {
> > > > +        return NULL;
> > > 
> > > ...but here we can return without freeing it...
> > > 
> > > > +    }
> > > > +
> > > > +    h = g_new0(struct qemu_xs_handle, 1);
> > > 
> > > ...and here we allocate a second time and overwrite the
> > > pointer to the first allocation.
> > > 
> > > Deleting the first call to g_new0() would fix both of these.
> > 
> > Indeed, thanks. Do you want a
> > 
> > Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> > 
> > or would you prefer me to submit the actual patch as described?
> 
> If you could submit the patch that would be easiest -- you're in
> a better position to test it.

I've been getting Paul to test the parts on actual Xen, so I'll send it
and let him test.


Attachment: smime.p7s
Description: S/MIME cryptographic signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.