[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/10] target/i386/cpu: Fix memleak in x86_cpu_class_check
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v2 06/10] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features |
Date: |
Tue, 01 Sep 2020 14:03:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Pan Nengyuan <pannengyuan@huawei.com> writes:
> '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>
> ---
> - V2: no changes in v2.
> ---
> 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,
x86_cpu_expand_features(xc, &err);
if (err) {
/* Errors at x86_cpu_expand_features should never happen,
* but in case it does, just report the model as not
* runnable at all using the "type" property.
*/
strList *new = g_new0(strList, 1);
> new->value = g_strdup("type");
> *next = new;
> next = &new->next;
> + error_free(err);
> }
>
> x86_cpu_filter_features(xc, false);
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Recommended cleanup: change x86_cpu_filter_features() to return true on
success, false on failure, then pass NULL here and check the return
value. Can be done on top.
- Re: [PATCH v2 06/10] target/i386/cpu: Fix memleak in x86_cpu_class_check_missing_features,
Markus Armbruster <=