video-overlay-composition: fix GSlice alloc/free size mismatch
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 19 Jul 2012 12:33:22 +0000 (13:33 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 19 Jul 2012 12:39:25 +0000 (13:39 +0100)
Fix copy'n'paste bug which made us allocate a slice of the
size of a rectangle for the overlay composition, but then
free it passing the size of an overlay composition, which
is not something GSlice takes to kindly, resulting in scary
aborts like:

***MEMORY-ERROR***: GSlice: assertion failed: sinfo->n_allocated > 0

Also, g_slice_new already includes a cast, so remove our
own casts, without which the compiler would probably have
told us about this ages ago.

https://bugzilla.gnome.org/show_bug.cgi?id=680091

gst-libs/gst/video/video-overlay-composition.c

index f153e0c..d2e37cc 100644 (file)
@@ -327,7 +327,7 @@ gst_video_overlay_composition_new (GstVideoOverlayRectangle * rectangle)
    * an empty new + _add() in a loop is easier? */
   g_return_val_if_fail (GST_IS_VIDEO_OVERLAY_RECTANGLE (rectangle), NULL);
 
-  comp = (GstVideoOverlayComposition *) g_slice_new0 (GstVideoOverlayRectangle);
+  comp = g_slice_new0 (GstVideoOverlayComposition);
 
   gst_mini_object_init (GST_MINI_OBJECT_CAST (comp), 0,
       GST_TYPE_VIDEO_OVERLAY_COMPOSITION,
@@ -694,7 +694,7 @@ gst_video_overlay_rectangle_new_argb (GstBuffer * pixels,
   g_return_val_if_fail (gst_buffer_get_size (pixels) >= height * width, NULL);
   g_return_val_if_fail (height > 0 && width > 0, NULL);
 
-  rect = (GstVideoOverlayRectangle *) g_slice_new0 (GstVideoOverlayRectangle);
+  rect = g_slice_new0 (GstVideoOverlayRectangle);
 
   gst_mini_object_init (GST_MINI_OBJECT_CAST (rect), 0,
       GST_TYPE_VIDEO_OVERLAY_RECTANGLE,