summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-04-16 19:53:14 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-04-16 19:53:46 +0200
commit93982071019c9378b22adb7c87d9cead093aebd9 (patch)
treed21e14320def7b2328549926c3952e47a7a01384
parent22e12979ee4744d66d84607a7397063fe2e169a8 (diff)
videoframe: Initialise GstVideoFrame to zeroes if mapping fails
This should allow for more meaningful errors. Dereferencing NULL is more useful information than dereferencing a random address happened to be on the stack.
-rw-r--r--gst-libs/gst/video/video-frame.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gst-libs/gst/video/video-frame.c b/gst-libs/gst/video/video-frame.c
index 01229cc37..537cf7092 100644
--- a/gst-libs/gst/video/video-frame.c
+++ b/gst-libs/gst/video/video-frame.c
@@ -130,6 +130,7 @@ gst_video_frame_map_id (GstVideoFrame * frame, GstVideoInfo * info,
no_metadata:
{
GST_ERROR ("no GstVideoMeta for id %d", id);
+ memset (frame, 0, sizeof (GstVideoFrame));
return FALSE;
}
frame_map_failed:
@@ -137,6 +138,7 @@ frame_map_failed:
GST_ERROR ("failed to map video frame plane %d", i);
while (--i >= 0)
gst_video_meta_unmap (meta, i, &frame->map[i]);
+ memset (frame, 0, sizeof (GstVideoFrame));
return FALSE;
}
map_failed:
@@ -149,6 +151,7 @@ invalid_size:
GST_ERROR ("invalid buffer size %" G_GSIZE_FORMAT " < %" G_GSIZE_FORMAT,
frame->map[0].size, info->size);
gst_buffer_unmap (buffer, &frame->map[0]);
+ memset (frame, 0, sizeof (GstVideoFrame));
return FALSE;
}
}