GNOME Bugzilla – Bug 753851
gstreamer: Fix memory leaks when context parse fails.
Last modified: 2015-10-02 14:31:36 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, libs).. If needed all these can be squashed into a single patch.
Created attachment 309654 [details] [review] gstreamer:tools: fix memory leaks during context parse failures. patch 1 for tools folder
Created attachment 309655 [details] [review] gstreamer:tests: fix memory leaks during context parse failures. patch 2: tests folder
Created attachment 309656 [details] [review] gstreamer:libs: fix memory leaks during context parse failures. patch 3: libs folder
Created attachment 309657 [details] [review] gstreamer:libs: fix memory leaks during context parse failures. patch 3: libs folder
Created attachment 309658 [details] [review] gstreamer:libs: fix memory leaks during context parse failures. libs patch got added twice by mistake.
Should probably change in docs as well i guess right? html and xml files.
Thanks, but please squash all the commits into one
Comment on attachment 309658 [details] [review] gstreamer:libs: fix memory leaks during context parse failures. No change needed here other than squashing, but note that g_error() will exit the application so the g_clear_error() after g_error() are useless... still good to have them for consistency.
should i change for the docs as well in this patch? I saw few html and xml files also needs changing
Yes please, also for the other patches if needed.
Created attachment 309680 [details] [review] gstreamer: fix memory leaks during context parse failures. squashed all the patches and added the changes to docs, *.xml files
commit 215cfcf993389c7950d58d7a37d9bfb0058b7ea6 Author: Vineeth TM <vineeth.tm@samsung.com> Date: Thu Aug 20 16:21:59 2015 +0900 gstreamer: 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=753851