[ZBX-9403] memory leak in function "get_host_availability_data" Created: 2015 Mar 15  Updated: 2017 May 30  Resolved: 2015 Mar 16

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P), Server (S)
Affects Version/s: 2.5.0
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: cheliequan Assignee: Unassigned
Resolution: Won't fix Votes: 0
Labels: memoryleak
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

CentOS 6.5 x64
Linux localhost 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


Attachments: Text File proxy.c     Text File proxy_c.patch    

 Description   

the zbx_host_availability_t struct no free in the function "get_host_availability_data".



 Comments   
Comment by cheliequan [ 2015 Mar 15 ]

memory leak in function "get_host_availability_data"

Comment by Aleksandrs Saveljevs [ 2015 Mar 16 ]

Array "ha" is a static array, which keeps its value between function invocations and is declared as follows:

static zbx_host_availability_t	*ha = NULL;
static int			ha_alloc = 0, ha_num = 0;

Error messages are strdup()-ed using ZBX_STRDUP(), which frees the old string before allocating a new one.

There is no need to free the "ha" array and its contents upon function exit - it will be reused in the next function call.

Generated at Wed Apr 09 15:02:46 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.