[ZBX-7392] Memory leaks in gnuregexp.c Created: 2013 Nov 17 Updated: 2017 May 30 Resolved: 2014 Sep 24 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent (G) |
Affects Version/s: | 2.2.0 |
Fix Version/s: | 2.2.2rc1, 2.3.1 |
Type: | Incident report | Priority: | Critical |
Reporter: | Etienne CHAMPETIER | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | memoryleak, regexps | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
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, 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 |
Comments |
Comment by Igors Homjakovs (Inactive) [ 2013 Nov 29 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7392 . |
Comment by Aleksandrs Saveljevs [ 2013 Dec 03 ] |
(1) This fixes a false positive: Index: src/zabbix_agent/active.c =================================================================== --- src/zabbix_agent/active.c (revision 40692) +++ src/zabbix_agent/active.c (working copy) @@ -740,7 +740,7 @@ { const char *__function_name = "process_value"; ZBX_ACTIVE_BUFFER_ELEMENT *el = NULL; - int i, ret = FAIL; + int i = 0, ret = FAIL; size_t sz; zabbix_log(LOG_LEVEL_DEBUG, "In %s() key:'%s:%s' value:'%s'", __function_name, host, key, value); igorsh RESOLVED in r40695 asaveljevs CLOSED |
Comment by Aleksandrs Saveljevs [ 2013 Dec 03 ] |
(2) Please take a look at r40694. It fixes some more warnings and a bit of style. igorsh Thank you for your fixes. I also fixed some code formatting in r40750. RESOLVED asaveljevs Please see r40755. It fixes formatting that was a bit off in r40750. RESOLVED. igorsh Thank you. I saw your modifications and accept them. CLOSED. |
Comment by Igors Homjakovs (Inactive) [ 2013 Dec 12 ] |
Fixed in 2.3.0 (trunk) r40932 and 2.2.2rc1 r40934 |
Comment by richlv [ 2014 Feb 18 ] |
(3) comment on sasha Of course, it is only related to Windows Agent. CLOSED <richlv> changelog entry still claims server and proxy are involved. REOPENED igorsh RESOLVED in r49275 and r49276. <richlv> changelog entry in 2.4 branch still claims server and proxy are involved. REOPENED igorsh RESOLVED in r49301. <richlv> thanks, looking good now - CLOSED |
Comment by MATSUDA Daiki [ 2014 Aug 26 ] |
r40934 fix should be applied to 2.0.x. r48076 too. |