apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Havard <brian.hav...@gmail.com>
Subject Re: cppcheck fixes
Date Tue, 06 Apr 2010 07:59:12 GMT
Stefan Fritsch wrote:
> Hi,
>
> I have tried the cppcheck static code analyzer on apr trunk and it 
> found some errors that may be worth fixing. For some, I have attached 
> a patch. These two I think are false positives/intentional:
>   

[...]

> I haven't looked at the rest:
>
> [./build/aplibtool.c:379]: (error) Memory leak: newarg
> [./build/aplibtool.c:637]: (error) Resource leak: dir
> [./build/jlibtool.c:978]: (error) Memory leak: path
> [./build/jlibtool.c:1775]: (error) Memory leak: cctemp
> [./build/jlibtool.c:1961]: (error) Resource leak: dir
> [./build/jlibtool.c:1653]: (error) Data is allocated but not 
> initialized: newpath

aplibtool/jlibtool do leak memory but this is by design. Because it's
always a very short lived process the heap is treated like a pool and no
attempt is made to free allocated memory.

The last two are probably worth fixing though, especially the last one
which does a strcat() into uninitialized memory. It clearly should be a
strcpy().


Mime
View raw message