GNOME Bugzilla – Bug 787885
pngenc: fix memory leak if input frame can't be mapped
Last modified: 2017-09-20 08:17:16 UTC
Created attachment 360038 [details] [review] attached the path Hi , In gst_pngenc_handle_frame() find the memory leak . code: row_pointers = g_new (png_byte *, GST_VIDEO_INFO_HEIGHT (info)); if (!gst_video_frame_map (&vframe, &pngenc->input_state->info, frame->input_buffer, GST_MAP_READ)) { GST_ELEMENT_ERROR (pngenc, STREAM, FORMAT, (NULL), ("Failed to map video frame, caps problem?")); ret = GST_FLOW_ERROR; goto done; } sol: g_free (row_pointers); attached the path. Please review and share the feedback.
Comment on attachment 360038 [details] [review] attached the path Thanks for the patch! I think a nicer way to fix this would be to move the row_pointers = g_new (...) line after the gts_video_frame_map() block.
Created attachment 360099 [details] [review] patch file attached Modified code. Patch attached . Please review it
Thanks! One more thing: when you update a patch, please tick the checkbox to obsolete the previous patch on the page where you add the attachment. commit c53bee067d9d7ed0f8ac010628d13f2a2081fc9b (HEAD -> master) Author: Ponnam Srinivas <p.srinivas@samsung.com> Date: Wed Sep 20 09:37:59 2017 +0530 pngenc: fix memory leak in error code path Don't leak row_pointers if frame can't be mapped. https://bugzilla.gnome.org/show_bug.cgi?id=787885
*** Bug 787058 has been marked as a duplicate of this bug. ***