GNOME Bugzilla – Bug 788119
a52dec: missed unref out buffer in error decoding block
Last modified: 2017-09-26 08:14:36 UTC
Created attachment 360336 [details] attached patch Hi , In gst_a52dec_handle_frame . missed unref out buffer in in error decoding. This lead to memory leak. code: outbuf = gst_buffer_new_and_alloc (256 * chans * (SAMPLE_WIDTH / 8) * num_blocks); gst_buffer_map (outbuf, &map, GST_MAP_WRITE); { guint8 *ptr = map.data; for (i = 0; i < num_blocks; i++) { if (a52_block (a52dec->state)) { /* also marks discont */ GST_AUDIO_DECODER_ERROR (a52dec, 1, STREAM, DECODE, (NULL), ("error decoding block %d", i), result); if (result != GST_FLOW_OK) { gst_buffer_unmap (outbuf, &map); goto exit; } } else { gint n, c; gint *reorder_map = a52dec->channel_reorder_map; for (n = 0; n < 256; n++) { for (c = 0; c < chans; c++) { ((sample_t *) ptr)[n * chans + reorder_map[c]] = a52dec->samples[c * 256 + n]; } } } ptr += 256 * chans * (SAMPLE_WIDTH / 8); } } sol: gst_buffer_unref (outbuf); Please review and share feedback.
Yes. Seems like a leak. Can you provide a "git format-patch" patch for fixing this issue? Please put proper name and email on the author field and write a good commit message (see our git log for examples). Thanks!
Created attachment 360396 [details] [review] attached patch Attached updated patch file. Added proper commit message. Please review it
commit 83d7d2f67a81ad0d99aaf616248a6aa57a1e6f01 (HEAD -> master) Author: Ponnam Srinivas <p.srinivas@samsung.com> Date: Tue Sep 26 10:11:24 2017 +0530 a52dec: Fix out buffer memory leak in error code path https://bugzilla.gnome.org/show_bug.cgi?id=788119