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 753852 - gstreamer: base: Fix memory leaks when context parse fails.
gstreamer: base: Fix memory leaks when context parse fails.
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-20 01:27 UTC by Vineeth
Modified: 2015-10-02 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstreamer:base:tools: fix memory leaks during context parse failures. (3.25 KB, patch)
2015-08-20 01:29 UTC, Vineeth
none Details | Review
gstreamer:base:tests: fix memory leaks during context parse failures. (5.70 KB, patch)
2015-08-20 01:43 UTC, Vineeth
none Details | Review
mklicensestable: fix memory leaks during context parse failures. (1.98 KB, patch)
2015-08-20 01:49 UTC, Vineeth
none Details | Review
gstreamer:base: fix memory leaks during context parse failures. (9.74 KB, patch)
2015-08-20 07:06 UTC, Vineeth
committed Details | Review

Description Vineeth 2015-08-20 01:27:57 UTC
In all places where g_option_context_parse is being used, when it fails, the context and error variables are not getting freed, which will result in memory leaks.
Along with that replacing g_error_free with g_clear_error in these files, which is a better way to free error, as it checks if the variable is Non-NULL and then sets it to NULL on freeing.

Making it into 3 patches for better readability, based on folders of the files.(tools, tests, gst-libs).. If needed all these can be squashed into a single patch.
Comment 1 Vineeth 2015-08-20 01:29:53 UTC
Created attachment 309659 [details] [review]
gstreamer:base:tools: fix memory leaks during context parse failures.

patch 1: tools folder
Comment 2 Vineeth 2015-08-20 01:43:02 UTC
Created attachment 309660 [details] [review]
gstreamer:base:tests: fix memory leaks during context parse failures.

patch 2: tests folder
Comment 3 Vineeth 2015-08-20 01:49:06 UTC
Created attachment 309661 [details] [review]
mklicensestable: fix memory leaks during context parse failures.

this doesn't get compiled. Did the change for complete coverage.
Maybe we can skip this if not needed
Comment 4 Sebastian Dröge (slomo) 2015-08-20 06:50:16 UTC
Thanks, but please squash all the commits into one
Comment 5 Vineeth 2015-08-20 07:06:52 UTC
Created attachment 309674 [details] [review]
gstreamer:base: fix memory leaks during context parse failures.
Comment 6 Luis de Bethencourt 2015-08-20 10:22:47 UTC
Good find Vineeth :)
Comment 7 Sebastian Dröge (slomo) 2015-10-02 14:26:51 UTC
commit 8e5f7f27f56e567ab31bb3986f4963fc30c39443
Author: Vineeth TM <vineeth.tm@samsung.com>
Date:   Thu Aug 20 15:59:15 2015 +0900

    gstreamer: base: Fix memory leaks when context parse fails.
    
    When g_option_context_parse fails, context and error variables are not getting free'd
    which results in memory leaks. Free'ing the same.
    
    And replacing g_error_free with g_clear_error, which checks if the error being passed
    is not NULL and sets the variable to NULL on free'ing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753852