qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gonglei <arei.gonglei@huawei.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/6] egl-helpers: fix possible resource leak
Date: Thu, 3 Mar 2016 12:19:24 +0100	[thread overview]
Message-ID: <56D81DBC.3040304@redhat.com> (raw)
In-Reply-To: <1456998223-12356-2-git-send-email-arei.gonglei@huawei.com>



On 03/03/2016 10:43, Gonglei wrote:
> CID 1352419, using g_strdup_printf instead of asprintf.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  ui/egl-helpers.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
> index 54be44c..2da1930 100644
> --- a/ui/egl-helpers.c
> +++ b/ui/egl-helpers.c
> @@ -50,18 +50,15 @@ int qemu_egl_rendernode_open(void)
>              continue;
>          }
>  
> -        r = asprintf(&p, "/dev/dri/%s", e->d_name);
> -        if (r < 0) {
> -            return -1;
> -        }
> +        p = g_strdup_printf("/dev/dri/%s", e->d_name);
>  
>          r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
>          if (r < 0) {
> -            free(p);
> +            g_free(p);
>              continue;
>          }
>          fd = r;
> -        free(p);
> +        g_free(p);
>          break;
>      }
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

  reply	other threads:[~2016-03-03 11:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  9:43 [Qemu-devel] [PATCH 0/6] fix some coverity complains Gonglei
2016-03-03  9:43 ` [Qemu-devel] [PATCH 1/6] egl-helpers: fix possible resource leak Gonglei
2016-03-03 11:19   ` Paolo Bonzini [this message]
2016-05-10  6:02     ` Gonglei (Arei)
2016-03-03  9:43 ` [Qemu-devel] [PATCH 2/6] sheepdog: fix possible resouce leak and out-of-bounds access Gonglei
2016-03-03 11:17   ` Paolo Bonzini
2016-03-03 12:00     ` Gonglei (Arei)
2016-03-03 12:12       ` Paolo Bonzini
2016-03-03 12:35         ` Gonglei (Arei)
2016-03-03  9:43 ` [Qemu-devel] [PATCH 3/6] spice: fix coverity complains Gonglei
2016-03-03 11:19   ` Paolo Bonzini
2016-05-10  5:59     ` Gonglei (Arei)
2016-03-03  9:43 ` [Qemu-devel] [PATCH 4/6] hostmem-file: fix memory leak Gonglei
2016-03-03 11:19   ` Paolo Bonzini
2016-03-03  9:43 ` [Qemu-devel] [PATCH 5/6] spapr: fix possible Negative array index read Gonglei
2016-03-03 11:19   ` Paolo Bonzini
2016-03-03  9:43 ` [Qemu-devel] [PATCH 6/6] smbus: fix memory leak Gonglei
2016-03-03 11:19   ` Paolo Bonzini
2016-03-03 12:05     ` Gonglei (Arei)
2016-04-06  2:12 ` [Qemu-devel] [PATCH 0/6] fix some coverity complains Gonglei (Arei)
2016-04-06  6:30   ` Paolo Bonzini
2016-04-06  6:31     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D81DBC.3040304@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).