Hi, reported two places might invoke twice of fclose, aof.c#L1211 and rdb.c#L1008, they are similar as followed:

    if (fclose(fp) == EOF) goto werr;
   ........
werr:
   .......
    fclose(fp);
   ........

while invoking twice of fclose is undefined behavior, you might want to take a look. (reference to the RETURN VALUE part of https://linux.die.net/man/3/fclose)

Regards,

Comment From: hwware

thanks @viennadd , this should be fixed by https://github.com/redis/redis/pull/7307 and https://github.com/redis/redis/pull/7919.