mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 20:05:38 +00:00
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
This commit is contained in:
parent
fb26575b73
commit
c53bee067d
1 changed files with 2 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue