After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734521 - sbcenc: Unref output caps in error cases
sbcenc: Unref output caps in error cases
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 1.4.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-09 11:40 UTC by Sebastian Rasmussen
Modified: 2014-08-12 07:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch. (2.16 KB, patch)
2014-08-09 11:41 UTC, Sebastian Rasmussen
needs-work Details | Review
Proposed patch. (4.17 KB, patch)
2014-08-11 12:13 UTC, Sebastian Rasmussen
committed Details | Review

Description Sebastian Rasmussen 2014-08-09 11:40:48 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.
Comment 1 Sebastian Rasmussen 2014-08-09 11:41:59 UTC
Created attachment 282979 [details] [review]
Proposed patch.
Comment 2 Tim-Philipp Müller 2014-08-10 10:53:49 UTC
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.
Comment 3 Sebastian Rasmussen 2014-08-11 12:13:24 UTC
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.
Comment 4 Sebastian Dröge (slomo) 2014-08-11 12:33:25 UTC
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