From: Peter Maydell Subject: Re: [Qemu-devel] [PATCH] xen_console: support the new extended xenstore protocol Date: Tue, 28 Jun 2011 13:03:30 +0100 Message-ID: References: <1309260898-3518-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1309260898-3518-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: stefano.stabellini@eu.citrix.com Cc: anthony.perard@citrix.com, xen-devel@lists.xensource.com, qemu-devel@nongnu.org, agraf@suse.de List-Id: xen-devel@lists.xenproject.org On 28 June 2011 12:34, wrote: > + =C2=A0 =C2=A0path =3D xs_get_domain_path(xs, domid); > + =C2=A0 =C2=A0if (path =3D=3D NULL) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0fprintf(stderr, "xs_get_domain_path() error\= n"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1; > + =C2=A0 =C2=A0} Don't we need to call xs_daemon_close() on these error-exit paths? > + =C2=A0 =C2=A0if (!xs_write(xs, XBT_NULL, path, pts, strlen(pts))) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0fprintf(stderr, "xs_write for '%s' fail", st= ring); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1; > + =C2=A0 =C2=A0} ...and this one's leaking the path string too. > +void xenstore_store_pv_console_info(int i, CharDriverState *chr) > +{ > + =C2=A0 =C2=A0char buf[32]; > + > + =C2=A0 =C2=A0if (i =3D=3D 0) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0snprintf(buf, sizeof(buf), "/console"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0store_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? -- PMM