diff mbox series

[PULL,4/4] qtest: do not return freed argument vector from qtest_rsp

Message ID 20201120171828.488611-5-thuth@redhat.com
State New
Headers show
Series [PULL,1/4] docs: Get rid of the weird _005f links in the man page | expand

Commit Message

Thomas Huth Nov. 20, 2020, 5:18 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

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>
Message-Id: <20201120073149.99079-1-pbonzini@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/qtest/libqtest.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;