summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-19 16:25:00 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-19 16:25:00 +0000
commit2711b370db589080300128fc634d71e897435ec9 (patch)
tree7ae6685edca3834cf6aeb7a03c054c30f2697d47
parentf2dcce7ce53aeb7679e0e0af40d59c0efb3062cc (diff)
downloadrsyslog-2711b370db589080300128fc634d71e897435ec9.tar.gz
rsyslog-2711b370db589080300128fc634d71e897435ec9.tar.xz
rsyslog-2711b370db589080300128fc634d71e897435ec9.zip
fixed another memory leak on HUPing and on exiting rsyslogd again thanks to
varmojfekoj for the patch
-rw-r--r--ChangeLog2
-rw-r--r--syslogd.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index cde1323b..74d6f43c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,8 @@ Version 1.17.1 (RGer), 2007-07-??
- minor code cleanup - thanks to Peter Vrabec for the patch
- fixed minimal memory leak on HUP (caused by templates)
thanks to varmojfekoj <varmojfekoj@gmail.com> for the patch
+- fixed another memory leak on HUPin and on exiting rsyslogd
+ again thanks to varmojfekoj <varmojfekoj@gmail.com> for the patch
- code cleanup (removed compiler warnings)
- fixed portability bug in configure.ac - thanks to Bartosz Kuźma for patch
- moved msg object into its own file set
diff --git a/syslogd.c b/syslogd.c
index 61388841..7b23a3da 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -6194,7 +6194,7 @@ static void doDie(int sig)
*/
static void die(int sig)
{
- register selector_t *f;
+ register selector_t *f, *fPrev;
char buf[256];
int i;
int was_initialized = Initialized;
@@ -6228,7 +6228,7 @@ static void die(int sig)
/* Free ressources and close MySQL connections */
- for (f = Files; f != NULL ; f = f->f_next) {
+ for (f = Files; f != NULL ;) {
/* free iovec if it was allocated */
if(f->f_iov != NULL) {
if(f->f_bMustBeFreed != NULL) {
@@ -6244,6 +6244,9 @@ static void die(int sig)
if (f->f_type == F_MYSQL)
closeMySQL(f);
#endif
+ fPrev = f;
+ f = f->f_next;
+ free(fPrev);
}
/* now clean up the listener part */
@@ -6273,7 +6276,6 @@ static void die(int sig)
* easier.
*/
tplDeleteAll();
- free(Files);
if(consfile.f_iov != NULL)
free(consfile.f_iov);
if(consfile.f_bMustBeFreed != NULL)
@@ -6907,6 +6909,9 @@ static void init()
pthread_mutex_destroy(&f->f_un.f_forw.mtxTCPSend);
}
# endif
+ if(f->f_pMsg != NULL)
+ MsgDestruct(f->f_pMsg);
+
/* done with this entry, we now need to delete itself */
fPrev = f;
f = f->f_next;