From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAFQu-0007Oj-B1 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAFQt-0001kW-34 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:40:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAFQs-0001kS-Tp for qemu-devel@nongnu.org; Wed, 01 Jul 2015 06:39:59 -0400 From: Juan Quintela Date: Wed, 1 Jul 2015 12:39:27 +0200 Message-Id: <1435747190-18017-4-git-send-email-quintela@redhat.com> In-Reply-To: <1435747190-18017-1-git-send-email-quintela@redhat.com> References: <1435747190-18017-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 03/26] rdma: fix memory leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, Gonglei From: Gonglei Variable "r" going out of scope leaks the storage it points to in line 3268. Signed-off-by: Gonglei Reviewed-by: Amit Shah Signed-off-by: Juan Quintela --- migration/rdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index b777273..0a00290 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') { -- 2.4.3