From 43359bb02f2823c9452c74c9273604eee61d6f6e Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 16 Oct 2007 00:59:39 +0000 Subject: [PATCH] Don't leak logfiles --- servers/slapd/bconfig.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 5aa496f74d..451045bf93 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -77,6 +77,7 @@ typedef struct { static CfBackInfo cfBackInfo; static char *passwd_salt; +static FILE *logfile; static char *logfileName; #ifdef SLAP_AUTH_REWRITE static BerVarray authz_rewrites; @@ -1124,6 +1125,10 @@ config_generic(ConfigArgs *c) { case CFG_LOGFILE: ch_free( logfileName ); logfileName = NULL; + if ( logfile ) { + fclose( logfile ); + logfile = NULL; + } break; case CFG_SERVERID: { @@ -1683,7 +1688,6 @@ sortval_reject: } break; case CFG_LOGFILE: { - FILE *logfile; if ( logfileName ) ch_free( logfileName ); logfileName = c->value_string; logfile = fopen(logfileName, "w");