GNOME Bugzilla – Bug 734521
sbcenc: Unref output caps in error cases
Last modified: 2014-08-12 07:53:11 UTC
gst_caps_intersect() returns a reference to a caps object which in the normal case is consumed, but in error cases must be unreferenced. The attached patch takes care of the unreferencing.
Created attachment 282979 [details] [review] Proposed patch.
Comment on attachment 282979 [details] [review] Proposed patch. >- else >+ else { >+ gst_caps_unref (output_caps); > return FALSE; >+ } >- else >+ else { >+ gst_caps_unref (output_caps); > return FALSE; >+ } >- else >+ else { >+ gst_caps_unref (output_caps); > return FALSE; >+ } > >- else >+ else { >+ gst_caps_unref (output_caps); > return FALSE; >+ } > >- if (!gst_audio_encoder_set_output_format (audio_enc, output_caps)) >+ if (!gst_audio_encoder_set_output_format (audio_enc, output_caps)) { >+ gst_caps_unref (output_caps); > return FALSE; >+ } Please add an 'error' or 'failure' or whatever goto label that does the unref + return FALSE and just 'goto' there instead.
Created attachment 283086 [details] [review] Proposed patch. Fixed patch tested using: gst-launch-1.0 audiotestsrc num-buffers=10 ! sbcenc ! sbcdec ! autoaudiosink which still produces sound. Setting various caps fields incorrectly generates expected errors.
commit 4482ce34230eecb4e5b7b8ce033311fc0a248c04 Author: Sebastian Rasmussen <sebras@hotmail.com> Date: Sat Aug 9 01:29:30 2014 +0200 sbcenc: Unref output caps in error cases gst_caps_intersect() returns a reference to a caps object which in the normal case is consumed, but in error cases must be unreferenced. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=734521