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

Memory leak when checking action condition "Template" = <template name>

    Details

      Description

      In the following code at src/zabbix_server/actions.c:116

      do
      {
      	result = DBselect(
      			"select distinct i.hostid,t.templateid"
      			" from items i,functions f,triggers t"
      			" where i.itemid=f.itemid"
      				" and f.triggerid=t.templateid"
      				" and t.triggerid=" ZBX_FS_UI64,
      			triggerid);
      
      	if (NULL != (row = DBfetch(result)))
      	{
      		ZBX_STR2UINT64(hostid, row[0]);
      		ZBX_STR2UINT64(triggerid, row[1]);
      
      		if (hostid == condition_value)
      		{
      			ret = SUCCEED;
      			break;
      		}
      	}
      	else
      		triggerid = 0;
      	DBfree_result(result);
      }
      while (SUCCEED != ret && 0 != triggerid);
      

      the result variable might not be freed with DBfree_result().

      A patch to fix it:

      Index: src/zabbix_server/actions.c
      ===================================================================
      --- src/zabbix_server/actions.c (revision 50119)
      +++ src/zabbix_server/actions.c (working copy)
      @@ -129,10 +129,7 @@
                                                      ZBX_STR2UINT64(triggerid, row[1]);
       
                                                      if (hostid == condition_value)
      -                                               {
                                                              ret = SUCCEED;
      -                                                       break;
      -                                               }
                                              }
                                              else
                                                      triggerid = 0;
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                wiper Andris Zeila
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: