[Geany-Devel] bug hunting #3

Colomban Wendling lists.ban at xxxxx
Thu Nov 7 22:28:29 UTC 2013


Le 07/11/2013 20:22, Pavel Roschin a écrit :
> [...]
> 
> https://gist.github.com/scriptum/7360333
> [...]
> === LEAKS ===
> ../geany/src/keyfile.c:665: error: Memory leak: tmp_array !NOT SURE. g_ptr_array_add called even for NULL???

Not sure either yet, looks kinda weird indeed.

> ../geany/src/symbols.c:1093: error: Memory leak: buffer

Yeah, but it's "only" a application-lifetime allocation.

> ../geany/src/build.c:2416: error: Memory leak: key
> ../geany/src/build.c:2633: error: Memory leak: key

Fixed.

> ../geany/src/utils.c:1062: error: Returning/dereferencing 'ioc' after it is deallocated / released !FALSE-POS (NOT SURE)

It is a false positive because g_io_add_watch() adds a reference and it
can't be dropped before function exit in a single-threaded application
at least.

> ../geany/src/utils.c:1844: error: Memory leak: tmp

And also str would have been leaked.  I removed tmp altogether and made
the function avoid that allocation, plus a few other improvements.

> ../geany/src/utils.c:739: portability: Non reentrant function 'localtime' called. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'.
> ../geany/src/utils.c:743: portability: Non reentrant function 'localtime' called. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'.
> ../geany/src/utils.c:1018: portability: Non reentrant function 'localtime' called. For threadsafe applications it is recommended to use the reentrant replacement function 'localtime_r'.

OK, but we're definitely not MT-safe :)

> ../geany/src/document.c:528: error: Memory leak: doc

False positive, the doc pointer is added to the documents array on L525,
so it's fine we just get the same one on line 528.

> ../geany/src/document.c:1546: error: Memory leak: conv_file_contents !FALSE-POS - check pointer, not error?

Yeah we could check conv_file_contents instead of conv_error, although
in practice it's probably identical.

> == Some funny warnings ===
> [...]

Fixed.  Though, it's weird GCC didn't report those with -Wformat=2, weird.


Thanks again!
Colomban


More information about the Devel mailing list