Commit c53bee06 authored by Ponnam Srinivas's avatar Ponnam Srinivas Committed by Tim-Philipp Müller

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
parent fb26575b
......@@ -304,7 +304,6 @@ gst_pngenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
png_set_write_fn (pngenc->png_struct_ptr, pngenc,
(png_rw_ptr) user_write_data, user_flush_data);
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),
......@@ -313,6 +312,8 @@ gst_pngenc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
goto done;
}
row_pointers = g_new (png_byte *, GST_VIDEO_INFO_HEIGHT (info));
for (row_index = 0; row_index < GST_VIDEO_INFO_HEIGHT (info); row_index++) {
row_pointers[row_index] = GST_VIDEO_FRAME_COMP_DATA (&vframe, 0) +
(row_index * GST_VIDEO_FRAME_COMP_STRIDE (&vframe, 0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment