fix segfault of expression based filters

This commit is contained in:
Peter Vrabec 2008-04-08 07:55:19 +00:00
parent 53396249c4
commit c264def2bf
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,52 @@
diff --git a/syslogd.c b/syslogd.c
index 355689c..4d9f825 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -1053,10 +1053,11 @@ static rsRetVal shouldProcessThisMessage(selector_t *f, msg_t *pMsg, int *bProce
finalize_it:
/* destruct in any case, not just on error, but it makes error handling much easier */
- if(pVM != NULL) {
- var.Destruct(&pResult);
+ if(pVM != NULL)
vm.Destruct(&pVM);
- }
+
+ if(pResult != NULL)
+ var.Destruct(&pResult);
*bProcessMsg = bRet;
RETiRet;
@@ -2837,12 +2838,11 @@ InitGlobalClasses(void)
/* the following classes were intialized by objClassInit() */
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(module, CORE_COMPONENT));
+ CHKiRet(objUse(var, CORE_COMPONENT));
/* initialize and use classes. We must be very careful with the order of events. Some
* classes use others and if we do not initialize them in the right order, we may end
* up with an invalid call. The most important thing that can happen is that an error
- pErrObj = "var";
- CHKiRet(objUse(var, CORE_COMPONENT));
* is detected and needs to be logged, wich in turn requires a broader number of classes
* to be available. The solution is that we take care in the order of calls AND use a
* class immediately after it is initialized. And, of course, we load those classes
@@ -2899,6 +2899,7 @@ GlobalClassExit(void)
objRelease(conf, CORE_COMPONENT);
objRelease(expr, CORE_COMPONENT);
objRelease(vm, CORE_COMPONENT);
+ objRelease(var, CORE_COMPONENT);
objRelease(datetime, CORE_COMPONENT);
/* TODO: implement the rest of the deinit */
@@ -2924,10 +2925,7 @@ GlobalClassExit(void)
CHKiRet(templateInit());
#endif
/* dummy "classes */
-dbgprintf("pre strExit()\n");
strExit();
-dbgprintf("post strExit()\n");
-
#if 0
CHKiRet(objGetObjInterface(&obj)); /* this provides the root pointer for all other queries */

View File

@ -3,7 +3,7 @@
Summary: Enhanced system logging and kernel message trapping daemons Summary: Enhanced system logging and kernel message trapping daemons
Name: rsyslog Name: rsyslog
Version: 3.14.1 Version: 3.14.1
Release: 2%{?dist} Release: 3%{?dist}
License: GPLv3+ License: GPLv3+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://www.rsyslog.com/ URL: http://www.rsyslog.com/
@ -12,6 +12,7 @@ Source1: rsyslog.init
Source2: rsyslog.conf Source2: rsyslog.conf
Source3: rsyslog.sysconfig Source3: rsyslog.sysconfig
Patch1: rsyslog-3.11.4-undef.patch Patch1: rsyslog-3.11.4-undef.patch
Patch2: rsyslog-3.14.1-segfaultExprFilt.patch
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: autoconf automake BuildRequires: autoconf automake
Requires: logrotate >= 3.5.2 Requires: logrotate >= 3.5.2
@ -67,6 +68,7 @@ authentication.
%prep %prep
%setup -q %setup -q
%patch1 -p1 -b .undef %patch1 -p1 -b .undef
%patch2 -p1 -b .segfaultExprFilt
%build %build
%configure --sbindir=%{sbindir} \ %configure --sbindir=%{sbindir} \
@ -158,6 +160,9 @@ fi
%{_libdir}/rsyslog/omgssapi.so %{_libdir}/rsyslog/omgssapi.so
%changelog %changelog
* Tue Apr 08 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-3
- fix segfault of expression based filters
* Mon Apr 07 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-2 * Mon Apr 07 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-2
- init script fixes (#441170,#440968) - init script fixes (#441170,#440968)