[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#6145) Resource leaks shown when running cppcheck against openldap
- To: openldap-its@OpenLDAP.org
- Subject: Re: (ITS#6145) Resource leaks shown when running cppcheck against openldap
- From: hyc@symas.com
- Date: Wed, 22 Jul 2009 05:20:59 GMT
- Auto-submitted: auto-generated (OpenLDAP-ITS)
Paul Albert wrote:
> Even if these are one shot commands, it could still mask a potential
> problem
that comes up in a later release that does have a real leak (think why any
programmer doesn't want any warnings in his code when building). Would you
consider making the changes if I were to get you a patch to fix all of these
problems? If I were to do this, would you like one patch to cover the entire
fix or a patch per file?
Thanks for the offer.
The use of scanf() in getpass.c was in code that was never actually compiled
before. Due to ITS#4643 I've removed the obsolete scanf() calls.
The assignment error detected in slapi_utils.c is wrong, there is no error in
this code. Your tool needs to be fixed.
dsaschema is a contrib module; you're welcome to submit a patch for that.
The code in thr_debug.c is not compiled by default; any developer who uses it
is expected to know what they're doing. Since the only way to free the table
being allocated is by use of something like an atexit() handler, and those
things tend to be non-portable, it's best left alone.
The code in tests/progs is never installed, it's only for internal testing
(and again, it's all one-shot commands) so none of that is of any concern.
ldapdelete.c and ldapmodrdn.c are now fixed in HEAD.
>> sleepy code/openldap-2.4.16> ../cppcheck-1.32/cppcheck -q .
>> [./clients/tools/ldapdelete.c:230]: (error) Resource leak: fp
>> [./clients/tools/ldapmodrdn.c:233]: (error) Memory leak: entrydn
>> [./clients/tools/ldapmodrdn.c:233]: (error) Memory leak: rdn
>> [./clients/tools/ldapmodrdn.c:233]: (error) Resource leak: fp
>> [./contrib/slapd-modules/dsaschema/dsaschema.c:260]: (error) Memory leak:
>> saveline
>> [./libraries/libldap_r/thr_debug.c:575]: (error) Memory leak: t
>> [./libraries/liblutil/getpass.c:128]: (style) Found 'scanf'. You should use
>> 'fgets' instead
>> [./libraries/liblutil/getpass.c:153]: (style) Found 'scanf'. You should use
>> 'fgets' instead
>> [./servers/slapd/slapi/slapi_utils.c:2511]: (error) Wrong assignement of an
>> auto-variable to an effective parameter of a function
>> [./tests/progs/slapd-addel.c:192]: (error) Memory leak: manager
>> [./tests/progs/slapd-addel.c:192]: (error) Memory leak: filename
>> [./tests/progs/slapd-modify.c:194]: (error) Memory leak: manager
>> [./tests/progs/slapd-modify.c:194]: (error) Memory leak: entry
>> [./tests/progs/slapd-modrdn.c:177]: (error) Memory leak: manager
>> [./tests/progs/slapd-read.c:227]: (error) Memory leak: manager
>> [./tests/progs/slapd-read.c:227]: (error) Memory leak: entry
>> [./tests/progs/slapd-read.c:227]: (error) Memory leak: filter
>> [./tests/progs/slapd-search.c:250]: (error) Memory leak: manager
>> [./tests/progs/slapd-search.c:250]: (error) Memory leak: sbase
>> [./tests/progs/slapd-search.c:250]: (error) Memory leak: filter
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/