diff options
author | Thomas Huth <thuth@redhat.com> | 2022-11-25 09:30:54 +0100 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2022-12-03 21:56:13 +0100 |
commit | 0f0a9e4e5c38c45ca7e6ac09cb36db21d42ec6dd (patch) | |
tree | 2cb91990acc36aa50b15a38390b749b2767d559e /tests/lcitool/projects | |
parent | c4ffd91aba1c3d878e99a3e7ba8aad4826728ece (diff) |
tests/qtest/migration-test: Fix unlink error and memory leaks
When running the migration test compiled with Clang from Fedora 37
and sanitizers enabled, there is an error complaining about unlink():
../tests/qtest/migration-test.c:1072:12: runtime error: null pointer
passed as argument 1, which is declared to never be null
/usr/include/unistd.h:858:48: note: nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../tests/qtest/migration-test.c:1072:12 in
(test program exited with status code 1)
TAP parsing error: Too few tests run (expected 33, got 20)
The data->clientcert and data->clientkey pointers can indeed be unset
in some tests, so we have to check them before calling unlink() with
those.
While we're at it, I also noticed that the code is only freeing
some but not all of the allocated strings in this function, and
indeed, valgrind is also complaining about memory leaks here.
So let's call g_free() on all allocated strings to avoid leaking
memory here.
Message-Id: <20221125083054.117504-1-thuth@redhat.com>
Tested-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/lcitool/projects')
0 files changed, 0 insertions, 0 deletions