GNOME Bugzilla – Bug 309130
Memory leak and uninitialized memory usage in backup conduit
Last modified: 2006-04-20 21:31:19 UTC
Version details: 2.0.13 Distribution/Version: Fedora Core 4 While working on fixing bug #274032 I ran into a memory leak and a uninitialized memory usage in the backup conduit while running gpilotd under valgrind. The following patch fixes those two issues, and is against gnome-pilot-2.0.13
Created attachment 48413 [details] [review] Fix memory leak and UMR in backup conduit
The exit_and_free label is really useless, the only spot its used is when f is NULL anyhow. Additionally we don't send an error in any case except if closing the file fails. I think the error handling should be restructured to fall through more gracefully and send an error in more error cases.
Interestingly, the submitted patch, included in the fc5 updated RPM (downgrading to pl 0.11.8) causes a crasher in pi_file_close, as it's being caused with null... On 0.12 pi_file_close tolerates a null argument. I hadn't noticed that this patch hadn't been incorporated. I'll take a look.
I've committed a patch incorporating most of the contributed patch. Includes a fix for a typo dating from 2001 that read uninitialised memory. Yuck. Many thanks for the patch.