[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] migration/rdma: cleanup rdma context before g_free to avoid
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 02/12] migration/rdma: cleanup rdma context before g_free to avoid memleaks |
Date: |
Mon, 1 Jun 2020 19:39:54 +0100 |
From: Pan Nengyuan <pannengyuan@huawei.com>
When error happen in initializing 'rdma_return_path', we should cleanup rdma
context
before g_free(rdma) to avoid some memleaks. This patch fix that.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200508100755.7875-3-pannengyuan@huawei.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/rdma.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 72e8b1c95b..ec45d33ba3 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4094,20 +4094,20 @@ void rdma_start_outgoing_migration(void *opaque,
rdma_return_path = qemu_rdma_data_init(host_port, errp);
if (rdma_return_path == NULL) {
- goto err;
+ goto return_path_err;
}
ret = qemu_rdma_source_init(rdma_return_path,
s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
if (ret) {
- goto err;
+ goto return_path_err;
}
ret = qemu_rdma_connect(rdma_return_path, errp);
if (ret) {
- goto err;
+ goto return_path_err;
}
rdma->return_path = rdma_return_path;
@@ -4120,6 +4120,8 @@ void rdma_start_outgoing_migration(void *opaque,
s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
migrate_fd_connect(s, NULL);
return;
+return_path_err:
+ qemu_rdma_cleanup(rdma);
err:
g_free(rdma);
g_free(rdma_return_path);
--
2.26.2
- [PULL 00/12] migration/virtiofs/hmp queue, Dr. David Alan Gilbert (git), 2020/06/01
- [PULL 02/12] migration/rdma: cleanup rdma context before g_free to avoid memleaks,
Dr. David Alan Gilbert (git) <=
- [PULL 03/12] hmp: Implement qom-get HMP command, Dr. David Alan Gilbert (git), 2020/06/01
- [PULL 04/12] hmp: Simplify qom-set, Dr. David Alan Gilbert (git), 2020/06/01
- Re: [PULL 04/12] hmp: Simplify qom-set, Markus Armbruster, 2020/06/02
- Re: [PULL 04/12] hmp: Simplify qom-set, Dr. David Alan Gilbert, 2020/06/02
- Re: [PULL 04/12] hmp: Simplify qom-set, David Hildenbrand, 2020/06/03
- Re: [PULL 04/12] hmp: Simplify qom-set, Dr. David Alan Gilbert, 2020/06/03
- Re: [PULL 04/12] hmp: Simplify qom-set, David Hildenbrand, 2020/06/03
- Re: [PULL 04/12] hmp: Simplify qom-set, David Hildenbrand, 2020/06/03
- Re: [PULL 04/12] hmp: Simplify qom-set, Dr. David Alan Gilbert, 2020/06/03
- Re: [PULL 04/12] hmp: Simplify qom-set, David Hildenbrand, 2020/06/03