diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-11-22 17:01:19 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-02-23 11:35:11 +0000 |
commit | 657cabcfce6794d2a2f629d63dbd56fc149dab2e (patch) | |
tree | 402bd1b6787ee65b93aad0d1b94ef9e9162e2178 /src/mm-sms-part-cdma.c | |
parent | dbdf67e9f7c55d7f70ed94449160a7ff254359a2 (diff) |
libmm-glib,common-helpers: make hexstr2bin() return a GError
This util method checks whether the input string is a valid hex
string, so make sure we return a GError on failure.
Diffstat (limited to 'src/mm-sms-part-cdma.c')
-rw-r--r-- | src/mm-sms-part-cdma.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/mm-sms-part-cdma.c b/src/mm-sms-part-cdma.c index fcfd85e9..39e2cc2f 100644 --- a/src/mm-sms-part-cdma.c +++ b/src/mm-sms-part-cdma.c @@ -317,24 +317,17 @@ mm_sms_part_cdma_new_from_pdu (guint index, gpointer log_object, GError **error) { - gsize pdu_len; - guint8 *pdu; - MMSmsPart *part; + g_autofree guint8 *pdu = NULL; + gsize pdu_len; /* Convert PDU from hex to binary */ - pdu = (guint8 *) mm_utils_hexstr2bin (hexpdu, &pdu_len); + pdu = (guint8 *) mm_utils_hexstr2bin (hexpdu, &pdu_len, error); if (!pdu) { - g_set_error_literal (error, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "Couldn't convert CDMA PDU from hex to binary"); + g_prefix_error (error, "Couldn't convert CDMA PDU from hex to binary: "); return NULL; } - part = mm_sms_part_cdma_new_from_binary_pdu (index, pdu, pdu_len, log_object, error); - g_free (pdu); - - return part; + return mm_sms_part_cdma_new_from_binary_pdu (index, pdu, pdu_len, log_object, error); } struct Parameter { |