|
|
ee3a35 |
From 890e3bb0d83719350ace0ee00b1d2d471333778d Mon Sep 17 00:00:00 2001
|
|
|
ee3a35 |
From: Rainer Gerhards <rgerhards@adiscon.com>
|
|
|
ee3a35 |
Date: Wed, 10 May 2017 11:46:45 +0200
|
|
|
ee3a35 |
Subject: [PATCH] core bugfix: memory leak when internal messages not processed
|
|
|
ee3a35 |
internally
|
|
|
ee3a35 |
|
|
|
ee3a35 |
In this case, the message object is not destructed, resulting in
|
|
|
ee3a35 |
a memory leak. Usually, this is no problem due to the low number
|
|
|
ee3a35 |
of internal message, but it can become an issue if a large number
|
|
|
ee3a35 |
of messages is emitted.
|
|
|
ee3a35 |
|
|
|
ee3a35 |
closes https://github.com/rsyslog/rsyslog/issues/1548
|
|
|
ee3a35 |
closes https://github.com/rsyslog/rsyslog/issues/1531
|
|
|
ee3a35 |
---
|
|
|
ee3a35 |
tools/rsyslogd.c | 4 +++-
|
|
|
ee3a35 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
ee3a35 |
|
|
|
ee3a35 |
diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c
|
|
|
ee3a35 |
index 417804e18..d2e5361a6 100644
|
|
|
ee3a35 |
--- a/tools/rsyslogd.c
|
|
|
ee3a35 |
+++ b/tools/rsyslogd.c
|
|
|
ee3a35 |
@@ -840,7 +840,7 @@ submitMsgWithDfltRatelimiter(smsg_t *pMsg)
|
|
|
ee3a35 |
|
|
|
ee3a35 |
|
|
|
ee3a35 |
static void
|
|
|
ee3a35 |
-logmsgInternal_doWrite(smsg_t *const __restrict__ pMsg)
|
|
|
ee3a35 |
+logmsgInternal_doWrite(smsg_t *pMsg)
|
|
|
ee3a35 |
{
|
|
|
ee3a35 |
if(bProcessInternalMessages) {
|
|
|
ee3a35 |
ratelimitAddMsg(internalMsg_ratelimiter, NULL, pMsg);
|
|
|
ee3a35 |
@@ -852,6 +852,8 @@ logmsgInternal_doWrite(smsg_t *const __restrict__ pMsg)
|
|
|
ee3a35 |
# else
|
|
|
ee3a35 |
syslog(pri, "%s", msg);
|
|
|
ee3a35 |
# endif
|
|
|
ee3a35 |
+ /* we have emitted the message and must destruct it */
|
|
|
ee3a35 |
+ msgDestruct(&pMsg);
|
|
|
ee3a35 |
}
|
|
|
ee3a35 |
}
|
|
|
ee3a35 |
|