qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] rdma: fix memory leak


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH v2] rdma: fix memory leak
Date: Tue, 23 Jun 2015 10:17:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

<address@hidden> wrote:
> From: Gonglei <address@hidden>
>
> Variable "r" going out of scope leaks the storage
> it points to in line 3268.
>
> Signed-off-by: Gonglei <address@hidden>
> Reviewed-by: Amit Shah <address@hidden>
> ---
>  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 <address@hidden>

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 via email to

[Prev in Thread] Current Thread [Next in Thread]