Patchwork [v2,02/13] qemu-socket: drop pointless allocation

login
register
mail settings
Submitter Gerd Hoffmann
Date June 24, 2013, 6:39 a.m.
Message ID <1372055996-4072-3-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/253645/
State New
Headers show

Comments

Gerd Hoffmann - June 24, 2013, 6:39 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 util/qemu-sockets.c |    1 -
 1 file changed, 1 deletion(-)
Markus Armbruster - June 24, 2013, 8:07 a.m.
Gerd Hoffmann <kraxel@redhat.com> writes:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  util/qemu-sockets.c |    1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index 86fb09c..35023a8 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -871,7 +871,6 @@ SocketAddress *socket_parse(const char *str, Error **errp)
>          }
>      } else {
>          addr->kind = SOCKET_ADDRESS_KIND_INET;
> -        addr->inet = g_new(InetSocketAddress, 1);
>          addr->inet = inet_parse(str, errp);
>          if (addr->inet == NULL) {
>              goto fail;

Plugs a memory leak, which is a bit more than "drop pointless
allocation".

Patch

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 86fb09c..35023a8 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -871,7 +871,6 @@  SocketAddress *socket_parse(const char *str, Error **errp)
         }
     } else {
         addr->kind = SOCKET_ADDRESS_KIND_INET;
-        addr->inet = g_new(InetSocketAddress, 1);
         addr->inet = inet_parse(str, errp);
         if (addr->inet == NULL) {
             goto fail;