Patchwork [v2,12/13] qemu-char: report udb backend errors

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

Comments

Gerd Hoffmann - June 24, 2013, 6:39 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 qemu-char.c |    2 ++
 1 file changed, 2 insertions(+)
Markus Armbruster - June 24, 2013, 8:06 a.m.
Typo in subject: s/udb/UDP/

Gerd Hoffmann <kraxel@redhat.com> writes:

> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  qemu-char.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 7d072a8..dcc91bb 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2255,6 +2255,8 @@ static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
>  
>      fd = inet_dgram_opts(opts, &local_err);
>      if (fd < 0) {
> +        qerror_report_err(local_err);
> +        error_free(local_err);
>          return NULL;
>      }
>      return qemu_chr_open_udp_fd(fd);

Also plugs memory leak on error path.  Worth mentioning in commit
message.

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 7d072a8..dcc91bb 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2255,6 +2255,8 @@  static CharDriverState *qemu_chr_open_udp(QemuOpts *opts)
 
     fd = inet_dgram_opts(opts, &local_err);
     if (fd < 0) {
+        qerror_report_err(local_err);
+        error_free(local_err);
         return NULL;
     }
     return qemu_chr_open_udp_fd(fd);