summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel París Díaz <mparisdiaz@gmail.com>2016-07-05 16:50:16 +0200
committerSebastian Dröge <sebastian@centricular.com>2016-07-25 13:17:36 +0300
commitf97c80ae1dc235b839214920cd91fab48f75b4b5 (patch)
treed315f39b3807b3b975647e628eba1c976880225e
parent5aba7d8bb78333cb16905df5f62dd00d3eed0805 (diff)
downloadgstreamer-f97c80ae1dc235b839214920cd91fab48f75b4b5.tar.gz
pad: check query caps answered and caps not NULL
https://bugzilla.gnome.org/show_bug.cgi?id=768450
-rw-r--r--gst/gstpad.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c
index a499411ae4..e52313cb35 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -2759,16 +2759,25 @@ gst_pad_get_allowed_caps (GstPad * pad)
/* Query peer caps */
query = gst_query_new_caps (mycaps);
- gst_pad_peer_query (pad, query);
+ if (!gst_pad_peer_query (pad, query)) {
+ GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "Caps query failed");
+ goto end;
+ }
+
gst_query_parse_caps_result (query, &caps);
+ if (caps == NULL) {
+ g_warn_if_fail (caps != NULL);
+ goto end;
+ }
gst_caps_ref (caps);
- gst_query_unref (query);
-
- gst_caps_unref (mycaps);
GST_CAT_DEBUG_OBJECT (GST_CAT_CAPS, pad, "allowed caps %" GST_PTR_FORMAT,
caps);
+end:
+ gst_query_unref (query);
+ gst_caps_unref (mycaps);
+
return caps;
no_peer: