Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7392

Memory leaks in gnuregexp.c

XMLWordPrintable

      Hi,

      i've just ran cppcheck (http://cppcheck.sourceforge.net/, a static code analyser) on zabbix codebase (svn revision 40328) and it found:

      [src/libs/zbxregexp/gnuregex.c:1176]: (error) Memory leak: compile_stack.stack
      [src/libs/zbxregexp/gnuregex.c:4849]: (error) Memory leak: regs.start
      [src/libs/zbxregexp/gnuregex.c:4849]: (error) Memory leak: regs.end
      [src/libs/zbxregexp/gnuregex.c:2603]: (error) Memory leak: fail_stack.stack
      

      FYI once cppcheck found a memory leak it stop checking for this variable,
      so you have to rerun it after correcting (you have to 'free' before each return)

      to run cppcheck:

      cppcheck --force -j8 . 2> ../cppcheck-zabbix.txt
      

      You can also run it with

      cppcheck --force --enable=all -j7 . 2> ../cppcheck-zabbix2.txt
      

      you will have many more advice but also more false positive

      You should consider running cppcheck before each release

            Unassigned Unassigned
            etienne.champetier Etienne CHAMPETIER
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: