[Geany-Devel] bug hunting #2

Colomban Wendling lists.ban at xxxxx
Sun Nov 3 21:37:48 UTC 2013


Le 03/11/2013 21:22, Pavel Roschin a écrit :
> Hello! Almost completed glib + Geany cppcheck config which leads to few new
> errors in code:
> 
> http://pastebin.com/EihjrKyC

Thanks, I fixed the leaks, but the mismatched allocator was false-positive.

> I removed some false-pos.
> 
> What do you think about goto-ing? Most leaks are because of return without
> free. Using goto instead of return and only one return at the end should be a
> good pattern which has no return-leaks (at least).

Well, it could be (I use it in some projects, though I tend to abuse ifs
to keep a linear code flow) but it's really not the norm in Geany code
so I'm not sure.  Moreover most of the leaks in your report could not
easily be avoided with a goto;  and the code that lead to them is very
ugly (e.g. in create_config_dir()) and should rather be rewritten
cleanly than patched with a goto.

Regards,
Colomban


More information about the Devel mailing list