sms: fix full data setting with `g_variant_new_from_data()'
The `g_variant_new_from_data()' method uses the original array during its operation, so we need to make sure it is valid as long as the method needs it, or we'll end up with Valgrind complaining a bit: ==4834== Invalid read of size 1 ==4834== at 0x36ADC75DA5: g_variant_get_byte (in /usr/lib64/libglib-2.0.so.0.3200.4) ==4834== by 0x3161ABED8C: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161ABEEA2: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161ABE844: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161ABE91E: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161ABEEA2: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161AC232E: g_dbus_message_to_blob (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161AB750A: ??? (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161AB9FEF: g_dbus_connection_send_message (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x3161ABDB22: g_dbus_connection_emit_signal (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x4C5B8BD: _mm_gdbus_sms_emit_changed (mm-gdbus-sms.c:2291) ==4834== by 0x36ADC47694: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3200.4) ==4834== Address 0x939efa0 is 0 bytes inside a block of size 512 free'd ==4834== at 0x4A079AE: free (vg_replace_malloc.c:427) ==4834== by 0x36ADC4D37E: g_free (in /usr/lib64/libglib-2.0.so.0.3200.4) ==4834== by 0x36ADC1CF40: ??? (in /usr/lib64/libglib-2.0.so.0.3200.4) ==4834== by 0x43C88E: assemble_sms (mm-sms.c:1260) ==4834== by 0x43CAD6: mm_sms_multipart_take_part (mm-sms.c:1329) ==4834== by 0x43E2EF: take_multipart (mm-sms-list.c:268) ==4834== by 0x43E546: mm_sms_list_take_part (mm-sms-list.c:328) ==4834== by 0x454C8F: mm_iface_modem_messaging_take_part (mm-iface-modem-messaging.c:353) ==4834== by 0x461DF6: sms_pdu_part_list_ready (mm-broadband-modem.c:5007) ==4834== by 0x3161A6CFB6: g_simple_async_result_complete (in /usr/lib64/libgio-2.0.so.0.3200.4) ==4834== by 0x432F82: at_command_parse_response (mm-base-modem-at.c:490) ==4834== by 0x489F96: handle_response (mm-at-serial-port.c:161)
This commit is contained in:
+3
-3
@@ -1046,8 +1046,8 @@ assemble_sms (MMSms *self,
|
||||
fulldata->data,
|
||||
fulldata->len * sizeof (guint8),
|
||||
TRUE,
|
||||
NULL,
|
||||
NULL),
|
||||
(GDestroyNotify) g_byte_array_unref,
|
||||
g_byte_array_ref (fulldata)),
|
||||
"smsc", mm_sms_part_get_smsc (sorted_parts[0]),
|
||||
"class", mm_sms_part_get_class (sorted_parts[0]),
|
||||
"number", mm_sms_part_get_number (sorted_parts[0]),
|
||||
@@ -1056,7 +1056,7 @@ assemble_sms (MMSms *self,
|
||||
NULL);
|
||||
|
||||
g_string_free (fulltext, TRUE);
|
||||
g_byte_array_free (fulldata, TRUE);
|
||||
g_byte_array_unref (fulldata);
|
||||
g_free (sorted_parts);
|
||||
|
||||
self->priv->is_assembled = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user