[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#6145) Resource leaks shown when running cppcheck against openldap



palbert1@yahoo.com wrote:
> Full_Name: Paul Albert
> Version: 2.4.16
> OS: SUSE Linux
> URL: N/A
> Submission from: (NULL) (198.24.6.168)
>
>
> As part of working on a new project, I'm running cppcheck against various pieces
> of code that we'll be using.  I downloaded cppcheck version 1.32 and ran it
> against open LDAP version 2.4.16.  cppcheck reported 18 file descriptor/memory
> leaks in the open LDAP code base in addition to 2 bad programming practices
> (labeled as style).  Visual inspection of the code verified these errors.
>
> The results are shown below and can be verified by running cppcheck against the
> open ldap code:

None of which matters, since these are all one-shot commands...
>
> 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/