mpegts: Don't confuse slice allocator with regular one

Previously selector_bytes and private_data_bytes were sometimes allocated and
free using the normal allocator and sometimes using the slice allocator.
Additionally prefer g_strdup() to g_memdup() for strings.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732789
This commit is contained in:
Sebastian Rasmussen 2014-07-06 01:55:16 +02:00 committed by Edward Hervey
parent 7626b494cb
commit 66c38b50f3

View file

@ -554,8 +554,8 @@ _gst_mpegts_dvb_linkage_descriptor_copy (GstMpegtsDVBLinkageDescriptor * source)
break; break;
} }
copy->private_data_bytes = g_slice_copy (source->private_data_length, copy->private_data_bytes = g_memdup (source->private_data_bytes,
source->private_data_bytes); source->private_data_length);
return copy; return copy;
} }
@ -578,8 +578,7 @@ gst_mpegts_dvb_linkage_descriptor_free (GstMpegtsDVBLinkageDescriptor * source)
break; break;
} }
if (source->private_data_bytes) g_free (source->private_data_bytes);
g_slice_free1 (source->private_data_length, source->private_data_bytes);
g_slice_free (GstMpegtsDVBLinkageDescriptor, source); g_slice_free (GstMpegtsDVBLinkageDescriptor, source);
} }
@ -1023,7 +1022,7 @@ _gst_mpegts_extended_event_descriptor_copy (GstMpegtsExtendedEventDescriptor *
copy = g_slice_dup (GstMpegtsExtendedEventDescriptor, source); copy = g_slice_dup (GstMpegtsExtendedEventDescriptor, source);
copy->items = g_ptr_array_ref (source->items); copy->items = g_ptr_array_ref (source->items);
copy->text = g_slice_copy (sizeof (source->text), source->text); copy->text = g_strdup (source->text);
return copy; return copy;
} }
@ -1906,7 +1905,7 @@ _gst_mpegts_dvb_data_broadcast_descriptor_copy (GstMpegtsDataBroadcastDescriptor
copy = g_slice_dup (GstMpegtsDataBroadcastDescriptor, source); copy = g_slice_dup (GstMpegtsDataBroadcastDescriptor, source);
copy->selector_bytes = g_slice_copy (source->length, source->selector_bytes); copy->selector_bytes = g_memdup (source->selector_bytes, source->length);
copy->language_code = g_strdup (source->language_code); copy->language_code = g_strdup (source->language_code);
copy->text = g_strdup (source->text); copy->text = g_strdup (source->text);