All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: <arei.gonglei@huawei.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	armbru@redhat.com, mrhines@us.ibm.com, amit.shah@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-trivial] [PATCH v2] rdma: fix memory leak
Date: Tue, 23 Jun 2015 10:17:56 +0200	[thread overview]
Message-ID: <87ioaerg7f.fsf@neno.neno> (raw)
In-Reply-To: <1435046198-10200-1-git-send-email-arei.gonglei@huawei.com> (arei gonglei's message of "Tue, 23 Jun 2015 15:56:38 +0800")

<arei.gonglei@huawei.com> wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Variable "r" going out of scope leaks the storage
> it points to in line 3268.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> ---
>  v2:
>   - Drop needless initialization. (Markus & Paolo)
>   - add Amit's R-by.
> ---
>  migration/rdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Juan Quintela <quintela@redhat.com>

Applied, thanks.


>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index cf5de7e..b5f9f82 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -3262,12 +3262,13 @@ static const QEMUFileOps rdma_write_ops = {
>  
>  static void *qemu_fopen_rdma(RDMAContext *rdma, const char *mode)
>  {
> -    QEMUFileRDMA *r = g_malloc0(sizeof(QEMUFileRDMA));
> +    QEMUFileRDMA *r;
>  
>      if (qemu_file_mode_is_not_valid(mode)) {
>          return NULL;
>      }
>  
> +    r = g_malloc0(sizeof(QEMUFileRDMA));
>      r->rdma = rdma;
>  
>      if (mode[0] == 'w') {


WARNING: multiple messages have this Message-ID (diff)
From: Juan Quintela <quintela@redhat.com>
To: arei.gonglei@huawei.com
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	armbru@redhat.com, mrhines@us.ibm.com, amit.shah@redhat.com,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] rdma: fix memory leak
Date: Tue, 23 Jun 2015 10:17:56 +0200	[thread overview]
Message-ID: <87ioaerg7f.fsf@neno.neno> (raw)
In-Reply-To: <1435046198-10200-1-git-send-email-arei.gonglei@huawei.com> (arei gonglei's message of "Tue, 23 Jun 2015 15:56:38 +0800")

<arei.gonglei@huawei.com> wrote:
> From: Gonglei <arei.gonglei@huawei.com>
>
> Variable "r" going out of scope leaks the storage
> it points to in line 3268.
>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> ---
>  v2:
>   - Drop needless initialization. (Markus & Paolo)
>   - add Amit's R-by.
> ---
>  migration/rdma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Juan Quintela <quintela@redhat.com>

Applied, thanks.


>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index cf5de7e..b5f9f82 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -3262,12 +3262,13 @@ static const QEMUFileOps rdma_write_ops = {
>  
>  static void *qemu_fopen_rdma(RDMAContext *rdma, const char *mode)
>  {
> -    QEMUFileRDMA *r = g_malloc0(sizeof(QEMUFileRDMA));
> +    QEMUFileRDMA *r;
>  
>      if (qemu_file_mode_is_not_valid(mode)) {
>          return NULL;
>      }
>  
> +    r = g_malloc0(sizeof(QEMUFileRDMA));
>      r->rdma = rdma;
>  
>      if (mode[0] == 'w') {

  reply	other threads:[~2015-06-23  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23  7:56 [Qemu-trivial] [PATCH v2] rdma: fix memory leak arei.gonglei
2015-06-23  7:56 ` [Qemu-devel] " arei.gonglei
2015-06-23  8:17 ` Juan Quintela [this message]
2015-06-23  8:17   ` Juan Quintela

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=87ioaerg7f.fsf@neno.neno \
    --to=quintela@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=mrhines@us.ibm.com \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.