[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qtest: do not return freed argument vector from qtest_rsp
From: |
Thomas Huth |
Subject: |
Re: [PATCH] qtest: do not return freed argument vector from qtest_rsp |
Date: |
Fri, 20 Nov 2020 13:38:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 |
On 20/11/2020 08.31, Paolo Bonzini wrote:
> If expected_args is 0, qtest frees the argument vector and then returns it
> nevertheless. Coverity complains; in practice this is not an issue because
> expected_args == 0 means that the caller is not interested in the argument
> vector, but it would be a potential problem if somebody wanted to add
> commands with optional arguments to qtest.
>
> Suggested-by: Kamil Dudka <kdudka@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/qtest/libqtest.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
> index be0fb430dd..e49f3a1e45 100644
> --- a/tests/qtest/libqtest.c
> +++ b/tests/qtest/libqtest.c
> @@ -545,6 +545,7 @@ redo:
> }
> } else {
> g_strfreev(words);
> + words = NULL;
> }
>
> return words;
>
Reviewed-by: Thomas Huth <thuth@redhat.com>