aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2015-06-23 15:56:38 +0800
committerJuan Quintela <quintela@redhat.com>2015-07-07 14:54:46 +0200
commit728470bea15b11ba7b3e3db54f0d9939908e0e65 (patch)
tree940a17829d596878afdf20f4ed51125cbe4f2c65 /migration
parent1452673888f6d7f0454276d049846c9bec659233 (diff)
rdma: fix memory leak
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> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/rdma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/migration/rdma.c b/migration/rdma.c
index b777273b59..0a00290160 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3263,12 +3263,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') {