summaryrefslogtreecommitdiff
path: root/gst/geometrictransform
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.com>2012-03-20 20:07:11 -0300
committerThiago Santos <thiago.sousa.santos@collabora.com>2012-03-20 20:11:30 -0300
commit7dd5b2002abf516ebdf92696c57a9a7692c166e9 (patch)
tree34c22e510b34880e83220e60b1dee057f654eaf0 /gst/geometrictransform
parent74471813eb616d4fa0edaab5c7d71ab303f6ef8c (diff)
downloadgstreamer-plugins-bad-7dd5b2002abf516ebdf92696c57a9a7692c166e9.tar.gz
geometrictransform: Prevent access to the transform map when it is null
Check if the map doesn't exist when receiving a new caps and create a new one. This prevents that the transform functions try to access the map when it doesn't exist.
Diffstat (limited to 'gst/geometrictransform')
-rw-r--r--gst/geometrictransform/gstgeometrictransform.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gst/geometrictransform/gstgeometrictransform.c b/gst/geometrictransform/gstgeometrictransform.c
index be651a477..a1ec3ab94 100644
--- a/gst/geometrictransform/gstgeometrictransform.c
+++ b/gst/geometrictransform/gstgeometrictransform.c
@@ -178,8 +178,8 @@ gst_geometric_transform_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
/* regenerate the map */
GST_OBJECT_LOCK (gt);
- if (old_width == 0 || old_height == 0 || gt->width != old_width ||
- gt->height != old_height) {
+ if (gt->map == NULL || old_width == 0 || old_height == 0
+ || gt->width != old_width || gt->height != old_height) {
if (klass->prepare_func)
if (!klass->prepare_func (gt)) {
GST_OBJECT_UNLOCK (gt);
@@ -352,6 +352,10 @@ gst_geometric_transform_stop (GstBaseTransform * trans)
GstGeometricTransform *gt = GST_GEOMETRIC_TRANSFORM_CAST (trans);
GST_INFO_OBJECT (gt, "Deleting transform map");
+
+ gt->width = 0;
+ gt->height = 0;
+
g_free (gt->map);
gt->map = NULL;