diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-18 07:02:27 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-10-18 07:02:27 +0200 |
commit | dc1f81addfd428fca2c8115ebbfdb2e8a26d8375 (patch) | |
tree | 87962f907f8dd900137925e5869c4ed6b67fac66 | |
parent | cc66470d2f9abf1746fa210403b99c50eb6f59d9 (diff) | |
download | rsyslog-dc1f81addfd428fca2c8115ebbfdb2e8a26d8375.tar.gz rsyslog-dc1f81addfd428fca2c8115ebbfdb2e8a26d8375.tar.bz2 rsyslog-dc1f81addfd428fca2c8115ebbfdb2e8a26d8375.zip |
bugfix: segfault if re_extract() function was used and no match found
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | grammar/rainerscript.c | 5 |
2 files changed, 5 insertions, 1 deletions
@@ -11,6 +11,7 @@ Version 7.4.5 [v7.4-stable] 2013-09-?? - now requires libestr 0.1.8 as early versions had a nasty bug in string comparisons - omelasticsearch: add failed.httprequests stats counter +- bugfix: segfault if re_extract() function was used and no match found - bugfix: omelasticsearch: correct failed.http stats counter - bugfix: omelasticsearch: did not correctly initialize stats counters - bugfix: omelasticsearch: failed.es counter was only maintained in bulk mode diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index f4833679..f9c5047c 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -1315,7 +1315,10 @@ finalize_it: if(bHadNoMatch) { cnfexprEval(func->expr[4], &r[4], usrptr); estr = var2String(&r[4], &bMustFree); - if(r[4].datatype == 'S') es_deleteStr(r[4].d.estr); + /* Note that we do NOT free the string that was returned/created + * for r[4]. We pass it to the caller, which in turn frees it. + * This saves us doing one unnecessary memory alloc & write. + */ } ret->datatype = 'S'; ret->d.estr = estr; |