[libvirt] Free name in xenDaemonLookupByID(), if virGetDomain() fails

On Tue, Sep 08, 2009 at 02:35:40PM +0200, Matthias Bolte wrote:
Subject says it all.
Matthias
diff --git a/src/xend_internal.c b/src/xend_internal.c index 2fa08f1..ed6fcac 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -3723,7 +3723,7 @@ xenDaemonLookupByID(virConnectPtr conn, int id) { }
ret = virGetDomain(conn, name, uuid); - if (ret == NULL) return NULL; + if (ret == NULL) goto error;
ret->id = id; VIR_FREE(name);
ACK, applied ! Thanks for chasing and for the patch mime-type :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

2009/9/8 Daniel Veillard <veillard@redhat.com>:
On Tue, Sep 08, 2009 at 02:35:40PM +0200, Matthias Bolte wrote:
Subject says it all.
Matthias
diff --git a/src/xend_internal.c b/src/xend_internal.c index 2fa08f1..ed6fcac 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -3723,7 +3723,7 @@ xenDaemonLookupByID(virConnectPtr conn, int id) { }
ret = virGetDomain(conn, name, uuid); - if (ret == NULL) return NULL; + if (ret == NULL) goto error;
ret->id = id; VIR_FREE(name);
ACK, applied ! Thanks for chasing and for the patch mime-type :-)
Daniel
For some reason the Google Mail web client detects patches with .patch extension as application/mbox now. If I rename it to .diff, it's correctly detected as text/x-diff. There seems to be no way to explicitly tell the client which mime-type an attachment should have. Anyway, here is another patch for a similar leak in xenDaemonLookupByUUID(). Matthias

On Tue, Sep 08, 2009 at 03:04:38PM +0200, Matthias Bolte wrote:
2009/9/8 Daniel Veillard <veillard@redhat.com>:
Thanks for chasing and for the patch mime-type :-)
Daniel
For some reason the Google Mail web client detects patches with .patch extension as application/mbox now. If I rename it to .diff, it's correctly detected as text/x-diff. There seems to be no way to explicitly tell the client which mime-type an attachment should have.
gahh, okay :-)
Anyway, here is another patch for a similar leak in xenDaemonLookupByUUID().
Matthias
diff --git a/src/xend_internal.c b/src/xend_internal.c index 2fa08f1..71287e3 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -3975,9 +3975,11 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid) return (NULL);
ret = virGetDomain(conn, name, uuid); - if (ret == NULL) return NULL; + if (ret == NULL) goto cleanup;
ret->id = id; + + cleanup: VIR_FREE(name); return (ret); }
Ah, right, applied and commited ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Matthias Bolte