tests: fix more memory leaks

This commit is contained in:
Ben Chan
2014-06-02 14:26:59 -07:00
committed by Aleksander Morgado
parent 830ef27bac
commit 7c389511d8
3 changed files with 14 additions and 4 deletions

View File

@@ -1591,8 +1591,9 @@ test_iccid_parse_short (void *f, gpointer d)
GError *error = NULL; GError *error = NULL;
parsed = mm_3gpp_parse_iccid (raw_iccid, &error); parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
g_assert (parsed == NULL);
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED); g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
g_free (parsed); g_error_free (error);
} }
static void static void
@@ -1603,8 +1604,9 @@ test_iccid_parse_invalid_chars (void *f, gpointer d)
GError *error = NULL; GError *error = NULL;
parsed = mm_3gpp_parse_iccid (raw_iccid, &error); parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
g_assert (parsed == NULL);
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED); g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
g_free (parsed); g_error_free (error);
} }
static void static void
@@ -1615,8 +1617,9 @@ test_iccid_parse_quoted_invalid_mii (void *f, gpointer d)
GError *error = NULL; GError *error = NULL;
parsed = mm_3gpp_parse_iccid (raw_iccid, &error); parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
g_assert (parsed == NULL);
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED); g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
g_free (parsed); g_error_free (error);
} }
static void static void
@@ -1627,8 +1630,9 @@ test_iccid_parse_unquoted_invalid_mii (void *f, gpointer d)
GError *error = NULL; GError *error = NULL;
parsed = mm_3gpp_parse_iccid (raw_iccid, &error); parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
g_assert (parsed == NULL);
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED); 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 (mem3->len == 2);
g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_SM)); g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_SM));
g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_MT)); g_assert (is_storage_supported (mem3, MM_SMS_STORAGE_MT));
g_array_unref (mem1);
g_array_unref (mem2);
g_array_unref (mem3);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -360,6 +360,7 @@ test_pdu_insufficient_data (void)
g_assert (part == NULL); g_assert (part == NULL);
/* We don't care for the specific error type */ /* We don't care for the specific error type */
g_assert (error != NULL); g_assert (error != NULL);
g_error_free (error);
g_free (hexpdu); g_free (hexpdu);
} }

View File

@@ -399,6 +399,7 @@ common_test_create_pdu (MMSmsCdmaTeleserviceId teleservice_id,
} }
pdu = mm_sms_part_cdma_get_submit_pdu (part, &len, &error); pdu = mm_sms_part_cdma_get_submit_pdu (part, &len, &error);
mm_sms_part_free (part);
trace_pdu (pdu, len); trace_pdu (pdu, len);