From: antirez Date: Fri, 4 Mar 2011 15:13:54 +0000 (+0100) Subject: AOF file descriptor leak fixed X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/4aec2ec8c4226f3894418c33f865e14866f2b283 AOF file descriptor leak fixed --- diff --git a/src/aof.c b/src/aof.c index 56392f2a..8ce6cd12 100644 --- a/src/aof.c +++ b/src/aof.c @@ -220,8 +220,10 @@ int loadAppendOnlyFile(char *filename) { int appendonly = server.appendonly; long loops = 0; - if (redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) + if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) { + fclose(fp); return REDIS_ERR; + } if (fp == NULL) { redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno));