[PATCH] libmbim-glib: Fix a memory leak in unitttest
Yunlian Jiang
yunlian at google.com
Tue Jul 22 08:13:22 PDT 2014
Hi Aleksander,
Please see below for a updated patch, please let me know if there
is any problem.
Thanks
This fixes a memory leak in test-message-parser.
---
src/libmbim-glib/test/test-message-parser.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libmbim-glib/test/test-message-parser.c
b/src/libmbim-glib/test/test-message-parser.c
index 6878f45..a71c8c5 100644
--- a/src/libmbim-glib/test/test-message-parser.c
+++ b/src/libmbim-glib/test/test-message-parser.c
@@ -653,6 +653,7 @@ test_message_parser_basic_connect_register_state (void)
MBIM_DATA_CLASS_HSUPA));
g_assert_cmpuint (current_cellular_class, ==, MBIM_CELLULAR_CLASS_GSM);
g_assert_cmpstr (provider_id, ==, "26006");
+ g_free (provider_id);
g_assert (provider_name == NULL);
g_assert (roaming_text == NULL);
g_assert_cmpuint (registration_flag, ==,
MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH);
--
2.0.0.526.g5318336
On Tue, Jul 22, 2014 at 2:24 AM, Aleksander Morgado
<aleksander at aleksander.es> wrote:
> Hey Yunlian!
>
> On 22/07/14 02:29, Yunlian Jiang wrote:
>> Original bug entry is at
>> https://code.google.com/p/chromium/issues/detail?id=394412&q=libmbim&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified
>>
>> In the unittest, it fails to free |provider_id|
>>
>> diff --git a/src/libmbim-glib/test/test-message-parser.c
>> b/src/libmbim-glib/test/test-message-parser.c
>> index d25374c..470bde6 100644
>> --- a/src/libmbim-glib/test/test-message-parser.c
>> +++ b/src/libmbim-glib/test/test-message-parser.c
>> @@ -653,6 +653,7 @@ test_message_parser_basic_connect_register_state (void)
>> MBIM_DATA_CLASS_HSUPA));
>> g_assert_cmpuint (current_cellular_class, ==, MBIM_CELLULAR_CLASS_GSM);
>> g_assert_cmpstr (provider_id, ==, "26006");
>> + g_free(provider_id);
>> g_assert (provider_name == NULL);
>> g_assert (roaming_text == NULL);
>> g_assert_cmpuint (registration_flag, ==,
>> MBIM_REGISTRATION_FLAG_PACKET_SERVICE_AUTOMATIC_ATTACH);
>>
>> Thanks
>>
>
> Thanks for the patch, but can you provide one that cleanly applies in
> git? i.e. created with git format-patch or git-send.
>
> Plus, a whitespace between the method name and the parenthesis :)
>
> I know it's a one liner, but I'm assuming it's worth for you to spend
> some time playing with git patch generation. If it's not worth for you
> or you don't want to, let me know and I'll just do the change myself :)
>
> Cheers!
>
> --
> Aleksander
> https://aleksander.es
More information about the libmbim-devel
mailing list