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

Memory leak when trying to use regexp_compile() for regular expression validation

XMLWordPrintable

    • Sprint 46, Nov 2018
    • 0.125

      Index: src/libs/zbxregexp/zbxregexp.c
      ===================================================================
      --- src/libs/zbxregexp/zbxregexp.c	(revision 86088)
      +++ src/libs/zbxregexp/zbxregexp.c	(working copy)
      @@ -61,12 +61,15 @@
       	if(NULL == pcre_regexp)
       		return FAIL;
       
      -	if(regexp)
      +	if (NULL != regexp)
       	{
       		*regexp = (zbx_regexp_t *)zbx_malloc(NULL, sizeof(zbx_regexp_t));
       		(*regexp)->pcre_regexp = pcre_regexp;
       	}
      +	else
      +		pcre_free(pcre_regexp);
       
      +
       	return SUCCEED;
       }
       
      

            wiper Andris Zeila
            wiper Andris Zeila
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: