[Qemu-devel] [PATCH RFC 3/6] migration: fix leak of src file on dst

Peter Xu posted 6 patches 8 years, 5 months ago
[Qemu-devel] [PATCH RFC 3/6] migration: fix leak of src file on dst
Posted by Peter Xu 8 years, 5 months ago
The return path channel is possibly leaked. Fix it.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/migration.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index e4f4c8c..92617fc 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -130,6 +130,11 @@ void migration_incoming_state_destroy(void)
 {
     struct MigrationIncomingState *mis = migration_incoming_get_current();
 
+    if (mis->to_src_file) {
+        qemu_fclose(mis->to_src_file);
+        mis->to_src_file = NULL;
+    }
+
     qemu_event_destroy(&mis->main_thread_load_event);
     loadvm_free_handlers(mis);
 }
-- 
2.7.4


Re: [Qemu-devel] [PATCH RFC 3/6] migration: fix leak of src file on dst
Posted by Juan Quintela 8 years, 5 months ago
Peter Xu <peterx@redhat.com> wrote:
> The return path channel is possibly leaked. Fix it.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/migration.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index e4f4c8c..92617fc 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -130,6 +130,11 @@ void migration_incoming_state_destroy(void)
>  {
>      struct MigrationIncomingState *mis = migration_incoming_get_current();
>  
> +    if (mis->to_src_file) {
> +        qemu_fclose(mis->to_src_file);
> +        mis->to_src_file = NULL;
> +    }
> +
>      qemu_event_destroy(&mis->main_thread_load_event);
>      loadvm_free_handlers(mis);
>  }

Reviewed-by: Juan Quintela <quintela@redhat.com>

Re: [Qemu-devel] [PATCH RFC 3/6] migration: fix leak of src file on dst
Posted by Juan Quintela 8 years, 5 months ago
Peter Xu <peterx@redhat.com> wrote:
> The return path channel is possibly leaked. Fix it.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/migration.c | 5 +++++
>  1 file changed, 5 insertions(+)
>

Queued this one.

Reviewed-by: Juan Quintela <quintela@redhat.com>



> diff --git a/migration/migration.c b/migration/migration.c
> index e4f4c8c..92617fc 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -130,6 +130,11 @@ void migration_incoming_state_destroy(void)
>  {
>      struct MigrationIncomingState *mis = migration_incoming_get_current();
>  
> +    if (mis->to_src_file) {
> +        qemu_fclose(mis->to_src_file);
> +        mis->to_src_file = NULL;
> +    }
> +
>      qemu_event_destroy(&mis->main_thread_load_event);
>      loadvm_free_handlers(mis);
>  }