diff mbox series

[07/12] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features

Message ID 20200814160241.7915-8-pannengyuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series fix some error memleaks | expand

Commit Message

Pan Nengyuan Aug. 14, 2020, 4:02 p.m. UTC
'err' forgot to free in x86_cpu_class_check_missing_features error path.
Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/cpu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Li Qiang Aug. 26, 2020, 12:25 p.m. UTC | #1
Pan Nengyuan <pannengyuan@huawei.com> 于2020年8月14日周五 下午6:38写道:
>
> 'err' forgot to free in x86_cpu_class_check_missing_features 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>

> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  target/i386/cpu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 588f32e136..4678aac0b4 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -4872,6 +4872,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
>          new->value = g_strdup("type");
>          *next = new;
>          next = &new->next;
> +        error_free(err);
>      }
>
>      x86_cpu_filter_features(xc, false);
> --
> 2.18.2
>
>
diff mbox series

Patch

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 588f32e136..4678aac0b4 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4872,6 +4872,7 @@  static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
         new->value = g_strdup("type");
         *next = new;
         next = &new->next;
+        error_free(err);
     }
 
     x86_cpu_filter_features(xc, false);