diff mbox series

irq: fix memory leak

Message ID 20171225024704.19540-1-linzhecheng@huawei.com
State New
Headers show
Series irq: fix memory leak | expand

Commit Message

linzhecheng Dec. 25, 2017, 2:47 a.m. UTC
entry is moved from list but is not freed.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>

Comments

Peter Xu Dec. 25, 2017, 5:33 a.m. UTC | #1
On Mon, Dec 25, 2017 at 10:47:04AM +0800, linzhecheng wrote:
> entry is moved from list but is not freed.
> 
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 351b64f77c..3c920db79a 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3494,6 +3494,7 @@ int kvm_arch_release_virq_post(int virq)
>          if (entry->virq == virq) {
>              trace_kvm_x86_remove_msi_route(virq);
>              QLIST_REMOVE(entry, list);
> +            g_free(entry);
>              break;
>          }
>      }
> -- 
> 2.12.2.windows.2
> 
> 
> 

My INBOX didn't really catch this email, don't know why.  Anyway,
thanks for fixing that.

Reviewed-by: Peter Xu <peterx@redhat.com>
Peter Xu Dec. 25, 2017, 6:59 a.m. UTC | #2
On Mon, Dec 25, 2017 at 10:47:04AM +0800, linzhecheng wrote:
> entry is moved from list but is not freed.
> 
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 351b64f77c..3c920db79a 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3494,6 +3494,7 @@ int kvm_arch_release_virq_post(int virq)
>          if (entry->virq == virq) {
>              trace_kvm_x86_remove_msi_route(virq);
>              QLIST_REMOVE(entry, list);
> +            g_free(entry);
>              break;
>          }
>      }
> -- 
> 2.12.2.windows.2
> 
> 

Reviewed-by: Peter Xu <peterx@redhat.com>
Michael S. Tsirkin Jan. 9, 2018, 4:13 a.m. UTC | #3
On Mon, Dec 25, 2017 at 10:47:04AM +0800, linzhecheng wrote:
> entry is moved from list but is not freed.
> 
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>


Makes sense.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 351b64f77c..3c920db79a 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3494,6 +3494,7 @@ int kvm_arch_release_virq_post(int virq)
>          if (entry->virq == virq) {
>              trace_kvm_x86_remove_msi_route(virq);
>              QLIST_REMOVE(entry, list);
> +            g_free(entry);
>              break;
>          }
>      }
> -- 
> 2.12.2.windows.2
>
Paolo Bonzini Jan. 9, 2018, 5:55 p.m. UTC | #4
On 25/12/2017 03:47, linzhecheng wrote:
> entry is moved from list but is not freed.
> 
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> 
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 351b64f77c..3c920db79a 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -3494,6 +3494,7 @@ int kvm_arch_release_virq_post(int virq)
>          if (entry->virq == virq) {
>              trace_kvm_x86_remove_msi_route(virq);
>              QLIST_REMOVE(entry, list);
> +            g_free(entry);
>              break;
>          }
>      }
> 

Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 351b64f77c..3c920db79a 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -3494,6 +3494,7 @@  int kvm_arch_release_virq_post(int virq)
         if (entry->virq == virq) {
             trace_kvm_x86_remove_msi_route(virq);
             QLIST_REMOVE(entry, list);
+            g_free(entry);
             break;
         }
     }