Closed Jan200101 closed 2 years ago
The && operator is "short circuit" in C. In the expression "A && B", B is only evaluated if A is true. If A is false, B is entirely skipped. In this case, A is true when "fopen((filename), "r+") == NULL". So the second call to fopen (line 25) only happens if the first fopen fails. Hence, there is no leak.
https://github.com/compuphase/minIni/blob/51d636f9c60f8d013860965565b447ef14dc2286/dev/minGlue-Linux.h#L23-L25 the file descriptor returned by the first fopen ends up being leaked