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

[Xen-devel] Re: [Qemu-devel] [PATCH] xen_console: support the new extended xenstore protocol



On Tue, 28 Jun 2011, Peter Maydell wrote:
> On 28 June 2011 12:34,  <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > + Â Âpath = xs_get_domain_path(xs, domid);
> > + Â Âif (path == NULL) {
> > + Â Â Â Âfprintf(stderr, "xs_get_domain_path() error\n");
> > + Â Â Â Âreturn -1;
> > + Â Â}
> 
> Don't we need to call xs_daemon_close() on these error-exit paths?
> 
> > + Â Âif (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) {
> > + Â Â Â Âfprintf(stderr, "xs_write for '%s' fail", string);
> > + Â Â Â Âreturn -1;
> > + Â Â}
> 
> ...and this one's leaking the path string too.
> 
> > +void xenstore_store_pv_console_info(int i, CharDriverState *chr)
> > +{
> > + Â Âchar buf[32];
> > +
> > + Â Âif (i == 0) {
> > + Â Â Â Âsnprintf(buf, sizeof(buf), "/console");
> > + Â Â Â Âstore_dev_info(xen_domid, chr, buf);
> 
> Am I missing something, or could you just pass "/console" straight
> to store_dev_info() without bothering to copy it into buf[] here?

All very good points as usual.
I'll send another patch with the error paths fixed and the useless
snprintf removed.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

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