diff mbox series

[RESEND,2/4] migration/rdma: Fix rdma_addrinfo res leaks

Message ID 20210520081148.17001-2-lizhijian@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series [RESEND,1/4] migration/rdma: cleanup rmda in rdma_start_incoming_migration error path | expand

Commit Message

Li, Zhijian May 20, 2021, 8:11 a.m. UTC
rdma_freeaddrinfo() is the reverse operation of rdma_getaddrinfo()

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 migration/rdma.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Dr. David Alan Gilbert May 24, 2021, 7:03 p.m. UTC | #1
* Li Zhijian (lizhijian@cn.fujitsu.com) wrote:
> rdma_freeaddrinfo() is the reverse operation of rdma_getaddrinfo()
> 
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

That call seems entirely undocumented, but looks like it's been there at
least 10 years.

> ---
>  migration/rdma.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 7e7595faab..651534e825 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -987,10 +987,12 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
>          }
>      }
>  
> +    rdma_freeaddrinfo(res);
>      ERROR(errp, "could not resolve address %s", rdma->host);
>      goto err_resolve_get_addr;
>  
>  route:
> +    rdma_freeaddrinfo(res);
>      qemu_rdma_dump_gid("source_resolve_addr", rdma->cm_id);
>  
>      ret = rdma_get_cm_event(rdma->channel, &cm_event);
> @@ -2593,6 +2595,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
>          break;
>      }
>  
> +    rdma_freeaddrinfo(res);
>      if (!e) {
>          ERROR(errp, "Error: could not rdma_bind_addr!");
>          goto err_dest_init_bind_addr;
> -- 
> 2.30.2
> 
> 
>
diff mbox series

Patch

diff --git a/migration/rdma.c b/migration/rdma.c
index 7e7595faab..651534e825 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -987,10 +987,12 @@  static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
         }
     }
 
+    rdma_freeaddrinfo(res);
     ERROR(errp, "could not resolve address %s", rdma->host);
     goto err_resolve_get_addr;
 
 route:
+    rdma_freeaddrinfo(res);
     qemu_rdma_dump_gid("source_resolve_addr", rdma->cm_id);
 
     ret = rdma_get_cm_event(rdma->channel, &cm_event);
@@ -2593,6 +2595,7 @@  static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         break;
     }
 
+    rdma_freeaddrinfo(res);
     if (!e) {
         ERROR(errp, "Error: could not rdma_bind_addr!");
         goto err_dest_init_bind_addr;