diff --git a/contrib/diagnose_corruption/check_flipped_bits.c b/contrib/diagnose_corruption/check_flipped_bits.c index ed3db57de..cc40ab84b 100644 --- a/contrib/diagnose_corruption/check_flipped_bits.c +++ b/contrib/diagnose_corruption/check_flipped_bits.c @@ -100,6 +100,8 @@ static char* readFile(const char* filename, size_t* size) { buf = malloc(*size); if (buf == NULL) { fprintf(stderr, "malloc failed\n"); + fclose(f); + return NULL; } bytes_read = fread(buf, 1, *size, f);