From: Howard Chu Date: Tue, 16 Oct 2007 00:59:39 +0000 (+0000) Subject: Don't leak logfiles X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~509 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=43359bb02f2823c9452c74c9273604eee61d6f6e;p=openldap Don't leak logfiles --- 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");