GNOME Bugzilla – Bug 753340
validate: media-check: Handle NULL GError in media descriptor writer
Last modified: 2015-10-02 15:40:07 UTC
err variable being passed to descriptor_writer and descriptor_parser, will get allocated memory incase of error scenarios. But the same is not getting freed
Created attachment 308874 [details] [review] fix memory leak
Comment on attachment 308874 [details] [review] fix memory leak Thanks for the patch. This doesn't look like the right GError use pattern to me. If code is not interested in the GError, it should just pass NULL instead of a GError address (if the API in question doesn't accept NULL for the GError address, that should be fixed). Next, the GError should probably be freed in the code path where the failure occured (we can/should assume that the GError is set in that case).
Created attachment 309384 [details] [review] Handle NULL GError parameter Media descriptor writer should be able to handle NULL GError parameter, and free the error variable in case of failures.
Created attachment 309385 [details] [review] If not using GError, pass NULL instead
Created attachment 309513 [details] [review] Handle NULL GError parameter as per changes in https://bugzilla.gnome.org/show_bug.cgi?id=753701 now when info is NULL, err will be filled. So there is no need to check for presence of info. And if NULL GError is being passed from the caller, freeing the GError else propagating the same.
commit e1c1c45eb82e79915f46bcbcf113f3287eefbed3 Author: Vineeth TM <vineeth.tm@samsung.com> Date: Mon Aug 17 10:40:22 2015 +0900 validate: media-check: Pass NULL instead of GError if not using it If not using the GError being passed on to media descriptor, writer and parser, simply pass NULL instead of GError. https://bugzilla.gnome.org/show_bug.cgi?id=753340 commit 15c87003b8c48a473b1160a5d93e12b06f3fe90c Author: Vineeth TM <vineeth.tm@samsung.com> Date: Mon Aug 17 10:31:33 2015 +0900 validate: descriptor-writer: Handle NULL GError address and free GError during error cases writer_new_discover() API should be able to accept NULL GError and in case of error, if GError is passed on as parameter, it should be propagated, else it should be free'd. https://bugzilla.gnome.org/show_bug.cgi?id=753340