diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | syslogd.c | 33 |
2 files changed, 35 insertions, 0 deletions
@@ -6,6 +6,8 @@ Version 1.17.3 (rgerhards), 2007-07-2? - rsyslogd now checks on startup if it is capable to performa any work at all. If it cant, it complains and terminates thanks to Michel Samia for providing the patch! +- fixed a small memory leak when HUPing syslogd. The allowed sender + list now gets freed. thanks varmojfekoj to for the patch. --------------------------------------------------------------------------- Version 1.17.2 (rgerhards), 2007-07-23 - made the port part of the -r option optional. Needed for backward @@ -745,6 +745,24 @@ static rsRetVal AddAllowedSenderEntry(struct AllowedSenders **ppRoot, struct All return RS_RET_OK; } +/* function to clear the allowed sender structure in cases where + * it must be freed (occurs most often when HUPed. + * TODO: reconsider recursive implementation + */ +static void clearAllowedSenders (struct AllowedSenders *pAllow) { + if (pAllow != NULL) { + if (pAllow->pNext != NULL) + clearAllowedSenders (pAllow->pNext); + else { + if (F_ISSET(pAllow->allowedSender.flags, ADDR_NAME)) + free (pAllow->allowedSender.addr.HostWildcard); + else + free (pAllow->allowedSender.addr.NetAddr); + + free (pAllow); + } + } +} /* function to add an allowed sender to the allowed sender list. The * root of the list is caller-provided, so it can be used for all @@ -4133,6 +4151,21 @@ static void init() pDfltProgNameCmp = NULL; eDfltHostnameCmpMode = HN_NO_COMP; + if (restart) { + if (pAllowedSenders_UDP != NULL) { + clearAllowedSenders (pAllowedSenders_UDP); + pAllowedSenders_UDP = NULL; + } + + if (pAllowedSenders_TCP != NULL) { + clearAllowedSenders (pAllowedSenders_TCP); + pAllowedSenders_TCP = NULL; + } + } + + assert (pAllowedSenders_UDP == NULL && + pAllowedSenders_TCP == NULL ); + nextp = NULL; /* I was told by an IPv6 expert that calling getservbyname() seems to be * still valid, at least for the use case we have. So I re-enabled that |