[ZBX-5988] Memory leaking occurs in evaluate_LOGEVENTID() and evaluate_STR() Created: 2012 Dec 13  Updated: 2017 May 30  Resolved: 2012 Dec 18

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 1.8.15, 2.0.4
Fix Version/s: 1.8.16rc1, 2.0.5rc1, 2.1.0

Type: Incident report Priority: Major
Reporter: Takanori Suzuki Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: memoryleak
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix Server 1.8.15/2.0.4 in Linux 32/64bit


Attachments: File zabbix-1.8.15-fix_evaluate_STR_LOGEVENTID_memory_leak.patch     File zabbix-2.0.4-fix_evaluate_STR_LOGEVENTID_memory_leak.patch    

 Description   

Memory leaking occurs in evaluate_LOGEVENTID() and evaluate_STR().
Both 1.8.x and 2.0.x has same memory leaking.

Zabbix Server memory leaks in evaluate_STR() and evaluate_LOGEVENTID() in "src/libs/zbxserver/evalfunc.c".
It doesn't free following strdup() memory in add_regexp_ex() called from evaluate_STR().
----------------------------------------------------------------------
(*regexps)[*regexps_num].name = strdup(name);
(*regexps)[*regexps_num].expression = strdup(expression);
----------------------------------------------------------------------
"clean_regexps_ex(regexps, regexps_num)" should be called before "zbx_free(regexps)" in evaluate_STR().

evaluate_STR() and evaluate_LOGEVENTID() are called when using "regexp()", "iregexp()", "logeventid()" trigger functions with "@" type regexp.
So, the memory leak occurs when using "regexp()", "iregexp()", "logeventid()" trigger functions with "@" type regexp.

I made patches for zabbix-1.8.15 and zabbix-2.0.4.
We thank you for your time and are hoping to receive feedback.



 Comments   
Comment by Andris Mednis [ 2012 Dec 18 ]

For v.1.8 fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-5988
Thanks to Takanori Suzuki for contributing patches!

Comment by Alexander Vladishev [ 2012 Dec 22 ]

Successfully tested!

In 2.0 and trunk should be fixed in lld.c:2278 too.

Andris lld.c fixed in r32339

Comment by Andris Mednis [ 2012 Dec 28 ]

Fixed in versions pre-1.8.16 rev. 32340, pre-2.0.5 rev. 32341 and pre-2.1.0 rev. 32342

Generated at Thu Apr 25 10:58:36 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.