All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] rdma: fix memory leak
@ 2015-06-23  1:02 ` arei.gonglei
  0 siblings, 0 replies; 12+ messages in thread
From: arei.gonglei @ 2015-06-23  1:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, amit.shah, Gonglei, mrhines, quintela

From: Gonglei <arei.gonglei@huawei.com>

Variable "r" going out of scope leaks the storage
it points to in line 3268.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 migration/rdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index cf5de7e..de80860 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 = NULL;
 
     if (qemu_file_mode_is_not_valid(mode)) {
         return NULL;
     }
 
+    r = g_malloc0(sizeof(QEMUFileRDMA));
     r->rdma = rdma;
 
     if (mode[0] == 'w') {
-- 
1.7.12.4




^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-06-23  9:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23  1:02 [Qemu-trivial] [PATCH] rdma: fix memory leak arei.gonglei
2015-06-23  1:02 ` [Qemu-devel] " arei.gonglei
2015-06-23  4:12 ` [Qemu-trivial] " Amit Shah
2015-06-23  4:12   ` [Qemu-devel] " Amit Shah
2015-06-23  7:36 ` [Qemu-trivial] " Markus Armbruster
2015-06-23  7:36   ` Markus Armbruster
2015-06-23  9:20   ` [Qemu-trivial] " Markus Armbruster
2015-06-23  9:20     ` Markus Armbruster
2015-06-23  9:32     ` [Qemu-trivial] " Gonglei
2015-06-23  9:32       ` Gonglei
2015-06-23  7:47 ` [Qemu-trivial] " Paolo Bonzini
2015-06-23  7:47   ` [Qemu-devel] " Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.