[PATCH] libmbim-glib: Fix a memory leak in unitttest

Aleksander Morgado aleksander at aleksander.es
Tue Jul 22 08:52:15 PDT 2014


On 22/07/14 17:13, Yunlian Jiang wrote:
> Hi Aleksander,
>    Please see below for a updated patch, please let me know if there
> is any problem.
> 
>    Thanks
> 

Yeah, the problem is that it is not a directly applicable git patch.
Usually there are 2 ways to send patches:

 * git format-patch: which will create an external file for each commit
you want to send, so that you can *attach* the patches to the email. So
for example imagine that you have a local branch with 2 commits on top
of the master branch, you could run "git format-match master" and that
will give you 2 files to attach to the email.

 * git send-email: with this method you can directly send the patches to
e.g. this mailing list. This method requires a bit more setup as you'll
need to configure your SMTP account and such, but is way more powerful
in the long run, especially as each patch is itself an email, and we can
review them separately by replying to each of the emails.

If you're just starting with this, I'd suggest you first try git
"format-patch" and attach the patches to the email.


> 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);
> 


-- 
Aleksander
https://aleksander.es


More information about the libmbim-devel mailing list