qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/qtest/migration-test: Fix unlink error and memory leak


From: Juan Quintela
Subject: Re: [PATCH] tests/qtest/migration-test: Fix unlink error and memory leaks
Date: Mon, 28 Nov 2022 17:18:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Daniel P. Berrangé <berrange@redhat.com> wrote:
> On Fri, Nov 25, 2022 at 09:30:54AM +0100, Thomas Huth wrote:
>> 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.
>> 
>> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]