diff options
author | Sebastian Rasmussen <sebras@hotmail.com> | 2014-08-09 13:20:41 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-08-11 08:48:52 +0200 |
commit | 2d9b8e3dd8c1b1504ce5f3e1ddc6bdc10d74afd1 (patch) | |
tree | eb2008f1591b8881026d9b662f3973f0868f971e /sys | |
parent | f5f967a78cb9365290ac5b36d9313daace30c03e (diff) | |
download | gstreamer-plugins-bad-2d9b8e3dd8c1b1504ce5f3e1ddc6bdc10d74afd1.tar.gz |
vtenc: Avoid leaking caps object and its copy
gst_pad_get_pad_template_caps() returns a reference which is unreferenced,
so creating a copy using gst_caps_copy() results in a reference leak. Also
the caps are pushed as an event downstream, but this doesn't consume the
caps so it must still be unreferenced.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734534
Diffstat (limited to 'sys')
-rw-r--r-- | sys/applemedia/vtenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index 7dee3404d..59e57bb06 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -425,7 +425,8 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf) return TRUE; } - caps = gst_caps_copy (gst_pad_get_pad_template_caps (self->srcpad)); + caps = gst_pad_get_pad_template_caps (self->srcpad); + caps = gst_caps_make_writable (caps); s = gst_caps_get_structure (caps, 0); gst_structure_set (s, "width", G_TYPE_INT, self->negotiated_width, @@ -459,6 +460,7 @@ gst_vtenc_negotiate_downstream (GstVTEnc * self, CMSampleBufferRef sbuf) } result = gst_pad_push_event (self->srcpad, gst_event_new_caps (caps)); + gst_caps_unref (caps); self->caps_width = self->negotiated_width; self->caps_height = self->negotiated_height; |