Check fopen failure in print_reconstruction_frame Fix Coverity defect CID 561345 Dereference null return value. Change-Id: I0b7f37c6adc6b9ec478404a3e1a45224fee4a397
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index 30d3522..bbd5b2d 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -12,6 +12,7 @@ #include <limits.h> #include <math.h> #include <stdio.h> +#include <stdlib.h> #include "config/aom_dsp_rtcd.h" #include "config/aom_scale_rtcd.h" @@ -1046,6 +1047,11 @@ recon_file = fopen(filename, "ab"); } + if (!recon_file) { + fprintf(stderr, "%s: fopen(\"%s\") failed", __func__, filename); + abort(); + } + fwrite(last_frame->buffer_alloc, last_frame->frame_size, 1, recon_file); fclose(recon_file); }