diff mbox series

[RESEND,v2,5/7] migration/colo: Plug memleaks in colo_process_incoming_thread

Message ID 20201023061218.2080844-6-kuhn.chenqun@huawei.com
State New
Headers show
Series some memleak trivial patchs | expand

Commit Message

Chenqun (kuhn) Oct. 23, 2020, 6:12 a.m. UTC
From: Pan Nengyuan <pannengyuan@huawei.com>

'local_err' forgot to free in colo_process_incoming_thread error path.
Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
Cc: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
---
 migration/colo.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Chenqun (kuhn) Dec. 14, 2020, 3:12 a.m. UTC | #1
Kindly ping!

Hi all,
  It's a bug, though it's trivial. 
Could you review it and add your queues or add trivial queues?

Thanks,
Chen Qun
> -----Original Message-----
> From: Chenqun (kuhn)
> Sent: Friday, October 23, 2020 2:12 PM
> To: qemu-devel@nongnu.org; qemu-trivial@nongnu.org
> Cc: Pannengyuan <pannengyuan@huawei.com>; lvivier@redhat.com;
> Zhanghailiang <zhang.zhanghailiang@huawei.com>; ganqixin
> <ganqixin@huawei.com>; Euler Robot <euler.robot@huawei.com>; Li Qiang
> <liq3ea@gmail.com>; Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Juan
> Quintela <quintela@redhat.com>; Dr. David Alan Gilbert
> <dgilbert@redhat.com>
> Subject: [PATCH RESEND v2 5/7] migration/colo: Plug memleaks in
> colo_process_incoming_thread
> 
> From: Pan Nengyuan <pannengyuan@huawei.com>
> 
> 'local_err' forgot to free in colo_process_incoming_thread error path.
> Fix that.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
> Reviewed-by: Li Qiang <liq3ea@gmail.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Hailiang Zhang <zhang.zhanghailiang@huawei.com>
> Cc: Juan Quintela <quintela@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> ---
>  migration/colo.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/migration/colo.c b/migration/colo.c index 3f1d3dfd95..7cc5a37192
> 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -886,7 +886,6 @@ void *colo_process_incoming_thread(void *opaque)
>      while (mis->state == MIGRATION_STATUS_COLO) {
>          colo_wait_handle_message(mis, fb, bioc, &local_err);
>          if (local_err) {
> -            error_report_err(local_err);
>              break;
>          }
> 
> @@ -922,6 +921,10 @@ out:
>          qemu_fclose(fb);
>      }
> 
> +    if (local_err) {
> +        error_report_err(local_err);
> +    }
> +
>      /* Hope this not to be too long to loop here */
>      qemu_sem_wait(&mis->colo_incoming_sem);
>      qemu_sem_destroy(&mis->colo_incoming_sem);
> --
> 2.23.0
diff mbox series

Patch

diff --git a/migration/colo.c b/migration/colo.c
index 3f1d3dfd95..7cc5a37192 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -886,7 +886,6 @@  void *colo_process_incoming_thread(void *opaque)
     while (mis->state == MIGRATION_STATUS_COLO) {
         colo_wait_handle_message(mis, fb, bioc, &local_err);
         if (local_err) {
-            error_report_err(local_err);
             break;
         }
 
@@ -922,6 +921,10 @@  out:
         qemu_fclose(fb);
     }
 
+    if (local_err) {
+        error_report_err(local_err);
+    }
+
     /* Hope this not to be too long to loop here */
     qemu_sem_wait(&mis->colo_incoming_sem);
     qemu_sem_destroy(&mis->colo_incoming_sem);