* [Qemu-trivial] [PATCH v2] rdma: fix memory leak
@ 2015-06-23 7:56 ` arei.gonglei
0 siblings, 0 replies; 4+ messages in thread
From: arei.gonglei @ 2015-06-23 7:56 UTC (permalink / raw)
To: qemu-devel
Cc: quintela, qemu-trivial, armbru, Gonglei, mrhines, amit.shah,
pbonzini
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>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
---
v2:
- Drop needless initialization. (Markus & Paolo)
- add Amit's R-by.
---
migration/rdma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index cf5de7e..b5f9f82 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;
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] 4+ messages in thread* [Qemu-devel] [PATCH v2] rdma: fix memory leak
@ 2015-06-23 7:56 ` arei.gonglei
0 siblings, 0 replies; 4+ messages in thread
From: arei.gonglei @ 2015-06-23 7:56 UTC (permalink / raw)
To: qemu-devel
Cc: quintela, qemu-trivial, armbru, Gonglei, mrhines, amit.shah,
pbonzini
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>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
---
v2:
- Drop needless initialization. (Markus & Paolo)
- add Amit's R-by.
---
migration/rdma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index cf5de7e..b5f9f82 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;
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] 4+ messages in thread* Re: [Qemu-trivial] [PATCH v2] rdma: fix memory leak
2015-06-23 7:56 ` [Qemu-devel] " arei.gonglei
@ 2015-06-23 8:17 ` Juan Quintela
-1 siblings, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2015-06-23 8:17 UTC (permalink / raw)
To: arei.gonglei
Cc: qemu-trivial, qemu-devel, armbru, mrhines, amit.shah, pbonzini
<arei.gonglei@huawei.com> wrote:
> 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>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> ---
> v2:
> - Drop needless initialization. (Markus & Paolo)
> - add Amit's R-by.
> ---
> migration/rdma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Juan Quintela <quintela@redhat.com>
Applied, thanks.
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index cf5de7e..b5f9f82 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;
>
> if (qemu_file_mode_is_not_valid(mode)) {
> return NULL;
> }
>
> + r = g_malloc0(sizeof(QEMUFileRDMA));
> r->rdma = rdma;
>
> if (mode[0] == 'w') {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [Qemu-devel] [PATCH v2] rdma: fix memory leak
@ 2015-06-23 8:17 ` Juan Quintela
0 siblings, 0 replies; 4+ messages in thread
From: Juan Quintela @ 2015-06-23 8:17 UTC (permalink / raw)
To: arei.gonglei
Cc: qemu-trivial, qemu-devel, armbru, mrhines, amit.shah, pbonzini
<arei.gonglei@huawei.com> wrote:
> 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>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> ---
> v2:
> - Drop needless initialization. (Markus & Paolo)
> - add Amit's R-by.
> ---
> migration/rdma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Juan Quintela <quintela@redhat.com>
Applied, thanks.
>
> diff --git a/migration/rdma.c b/migration/rdma.c
> index cf5de7e..b5f9f82 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;
>
> if (qemu_file_mode_is_not_valid(mode)) {
> return NULL;
> }
>
> + r = g_malloc0(sizeof(QEMUFileRDMA));
> r->rdma = rdma;
>
> if (mode[0] == 'w') {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-23 8:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 7:56 [Qemu-trivial] [PATCH v2] rdma: fix memory leak arei.gonglei
2015-06-23 7:56 ` [Qemu-devel] " arei.gonglei
2015-06-23 8:17 ` [Qemu-trivial] " Juan Quintela
2015-06-23 8:17 ` [Qemu-devel] " Juan Quintela
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.