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 787885 - pngenc: fix memory leak if input frame can't be mapped
pngenc: fix memory leak if input frame can't be mapped
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.13.x
Other All
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 787058 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-09-19 11:24 UTC by Ponnam Srinivas
Modified: 2017-09-20 08:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
attached the path (874 bytes, patch)
2017-09-19 11:24 UTC, Ponnam Srinivas
needs-work Details | Review
patch file attached (1.27 KB, patch)
2017-09-20 04:12 UTC, Ponnam Srinivas
committed Details | Review

Description Ponnam Srinivas 2017-09-19 11:24:34 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 1 Tim-Philipp Müller 2017-09-19 12:41:22 UTC
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.
Comment 2 Ponnam Srinivas 2017-09-20 04:12:16 UTC
Created attachment 360099 [details] [review]
patch file attached

Modified code. Patch attached . Please review it
Comment 3 Tim-Philipp Müller 2017-09-20 08:04:46 UTC
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
Comment 4 Tim-Philipp Müller 2017-09-20 08:17:16 UTC
*** Bug 787058 has been marked as a duplicate of this bug. ***