[PATCH] tests: fix more memory leaks
Aleksander Morgado
aleksander at aleksander.es
Tue Jun 3 01:53:36 PDT 2014
On 02/06/14 23:26, Ben Chan wrote:
> ---
> src/tests/test-modem-helpers.c | 16 ++++++++++++----
> src/tests/test-sms-part-3gpp.c | 1 +
> src/tests/test-sms-part-cdma.c | 1 +
> 3 files changed, 14 insertions(+), 4 deletions(-)
>
Pushed, thanks.
> diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
> index cc96261..6175a05 100644
> --- a/src/tests/test-modem-helpers.c
> +++ b/src/tests/test-modem-helpers.c
> @@ -1591,8 +1591,9 @@ test_iccid_parse_short (void *f, gpointer d)
> GError *error = NULL;
>
> parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
> + g_assert (parsed == NULL);
> g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
> - g_free (parsed);
> + g_error_free (error);
> }
>
> static void
> @@ -1603,8 +1604,9 @@ test_iccid_parse_invalid_chars (void *f, gpointer d)
> GError *error = NULL;
>
> parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
> + g_assert (parsed == NULL);
> g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
> - g_free (parsed);
> + g_error_free (error);
> }
>
> static void
> @@ -1615,8 +1617,9 @@ test_iccid_parse_quoted_invalid_mii (void *f, gpointer d)
> GError *error = NULL;
>
> parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
> + g_assert (parsed == NULL);
> g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
> - g_free (parsed);
> + g_error_free (error);
> }
>
> static void
> @@ -1627,8 +1630,9 @@ test_iccid_parse_unquoted_invalid_mii (void *f, gpointer d)
> GError *error = NULL;
>
> parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
> + g_assert (parsed == NULL);
> g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
> - g_free (parsed);
> + g_error_free (error);
> }
>
> /*****************************************************************************/
> @@ -1840,6 +1844,10 @@ test_cpms_response_cinterion (void *f, gpointer d)
> g_assert (mem3->len == 2);
> g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_SM));
> g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_MT));
> +
> + g_array_unref (mem1);
> + g_array_unref (mem2);
> + g_array_unref (mem3);
> }
>
> /*****************************************************************************/
> diff --git a/src/tests/test-sms-part-3gpp.c b/src/tests/test-sms-part-3gpp.c
> index dc470d7..21822f0 100644
> --- a/src/tests/test-sms-part-3gpp.c
> +++ b/src/tests/test-sms-part-3gpp.c
> @@ -360,6 +360,7 @@ test_pdu_insufficient_data (void)
> g_assert (part == NULL);
> /* We don't care for the specific error type */
> g_assert (error != NULL);
> + g_error_free (error);
> g_free (hexpdu);
> }
>
> diff --git a/src/tests/test-sms-part-cdma.c b/src/tests/test-sms-part-cdma.c
> index 644de8d..17d7896 100644
> --- a/src/tests/test-sms-part-cdma.c
> +++ b/src/tests/test-sms-part-cdma.c
> @@ -399,6 +399,7 @@ common_test_create_pdu (MMSmsCdmaTeleserviceId teleservice_id,
> }
>
> pdu = mm_sms_part_cdma_get_submit_pdu (part, &len, &error);
> + mm_sms_part_free (part);
>
> trace_pdu (pdu, len);
>
>
--
Aleksander
https://aleksander.es
More information about the ModemManager-devel
mailing list