mpegts: Don't confuse slice allocator with regular one
authorSebastian Rasmussen <sebras@hotmail.com>
Sat, 5 Jul 2014 23:55:16 +0000 (01:55 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 9 Jul 2014 10:04:17 +0000 (12:04 +0200)
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

gst-libs/gst/mpegts/gst-dvb-descriptor.c

index 94328b0..c1f2c30 100644 (file)
@@ -554,8 +554,8 @@ _gst_mpegts_dvb_linkage_descriptor_copy (GstMpegtsDVBLinkageDescriptor * source)
       break;
   }
 
-  copy->private_data_bytes = g_slice_copy (source->private_data_length,
-      source->private_data_bytes);
+  copy->private_data_bytes = g_memdup (source->private_data_bytes,
+      source->private_data_length);
 
   return copy;
 }
@@ -578,8 +578,7 @@ gst_mpegts_dvb_linkage_descriptor_free (GstMpegtsDVBLinkageDescriptor * source)
         break;
     }
 
-  if (source->private_data_bytes)
-    g_slice_free1 (source->private_data_length, source->private_data_bytes);
+  g_free (source->private_data_bytes);
   g_slice_free (GstMpegtsDVBLinkageDescriptor, source);
 }
 
@@ -1023,7 +1022,7 @@ _gst_mpegts_extended_event_descriptor_copy (GstMpegtsExtendedEventDescriptor *
 
   copy = g_slice_dup (GstMpegtsExtendedEventDescriptor, source);
   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;
 }
@@ -1906,7 +1905,7 @@ _gst_mpegts_dvb_data_broadcast_descriptor_copy (GstMpegtsDataBroadcastDescriptor
 
   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->text = g_strdup (source->text);