From 1d267dc5d661479e760b6e60bada16aa576ff944 Mon Sep 17 00:00:00 2001 From: Bimba Shrestha Date: Fri, 3 Apr 2020 13:39:02 -0700 Subject: [PATCH] returning on null check --- contrib/diagnose_corruption/check_flipped_bits.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2