tests: fix memory leaks
This patch fixes memory leaks in unit tests detected by LeakSanitizer.
This commit is contained in:
committed by
Aleksander Morgado
parent
c2d3704aa5
commit
6e7bae9dc5
@@ -711,6 +711,7 @@ test_creg_match (const char *test,
|
||||
g_assert_cmpuint (regex_num, ==, result->regex_num);
|
||||
|
||||
success = mm_3gpp_parse_creg_response (info, &state, &lac, &ci, &access_tech, &cgreg, &cereg, &error);
|
||||
g_match_info_free (info);
|
||||
g_assert (success);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpuint (state, ==, result->state);
|
||||
@@ -1445,6 +1446,7 @@ test_devid_item (void *f, gpointer d)
|
||||
if (strcmp (devid, item->devid))
|
||||
g_message ("%s", devid);
|
||||
g_assert (!strcmp (devid, item->devid));
|
||||
g_free (devid);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1536,6 +1538,7 @@ test_iccid_parse_quoted_swap_19_digit (void *f, gpointer d)
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (parsed, ==, expected);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1549,6 +1552,7 @@ test_iccid_parse_unquoted_swap_20_digit (void *f, gpointer d)
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (parsed, ==, expected);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1562,6 +1566,7 @@ test_iccid_parse_unquoted_unswapped_19_digit (void *f, gpointer d)
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (parsed, ==, expected);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1575,6 +1580,7 @@ test_iccid_parse_quoted_unswapped_20_digit (void *f, gpointer d)
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_cmpstr (parsed, ==, expected);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1586,6 +1592,7 @@ test_iccid_parse_short (void *f, gpointer d)
|
||||
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1597,6 +1604,7 @@ test_iccid_parse_invalid_chars (void *f, gpointer d)
|
||||
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1608,6 +1616,7 @@ test_iccid_parse_quoted_invalid_mii (void *f, gpointer d)
|
||||
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1619,6 +1628,7 @@ test_iccid_parse_unquoted_invalid_mii (void *f, gpointer d)
|
||||
|
||||
parsed = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||
g_assert_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED);
|
||||
g_free (parsed);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -227,6 +227,7 @@ qcdm_test_child (int fd, GAsyncReadyCallback cb)
|
||||
|
||||
qcdm_request_verinfo (port, cb, loop);
|
||||
g_main_loop_run (loop);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
mm_port_serial_close (MM_PORT_SERIAL (port));
|
||||
g_object_unref (port);
|
||||
|
||||
@@ -528,10 +528,12 @@ common_test_create_pdu (const gchar *smsc,
|
||||
if (number)
|
||||
mm_sms_part_set_number (part, number);
|
||||
if (text) {
|
||||
gchar **out;
|
||||
MMSmsEncoding encoding = MM_SMS_ENCODING_UNKNOWN;
|
||||
|
||||
/* Detect best encoding */
|
||||
mm_sms_part_3gpp_util_split_text (text, &encoding);
|
||||
out = mm_sms_part_3gpp_util_split_text (text, &encoding);
|
||||
g_strfreev (out);
|
||||
mm_sms_part_set_text (part, text);
|
||||
mm_sms_part_set_encoding (part, encoding);
|
||||
}
|
||||
@@ -544,6 +546,7 @@ common_test_create_pdu (const gchar *smsc,
|
||||
&len,
|
||||
&msgstart,
|
||||
&error);
|
||||
mm_sms_part_free (part);
|
||||
|
||||
trace_pdu (pdu, len);
|
||||
|
||||
@@ -726,6 +729,8 @@ common_test_text_split (const gchar *text,
|
||||
for (i = 0; out[i]; i++) {
|
||||
g_assert_cmpstr (out[i], ==, expected[i]);
|
||||
}
|
||||
|
||||
g_strfreev (out);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user