diff --git a/doc/examples/resampling_audio.c b/doc/examples/resampling_audio.c
index 8a43b0903992146c2d0cd509e08497f16ceea0e2..f35e7e17796572ce149be3417c0faeb4b461c388 100644
--- a/doc/examples/resampling_audio.c
+++ b/doc/examples/resampling_audio.c
@@ -199,8 +199,7 @@ int main(int argc, char **argv)
             fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
 
 end:
-    if (dst_file)
-        fclose(dst_file);
+    fclose(dst_file);
 
     if (src_data)
         av_freep(&src_data[0]);
diff --git a/doc/examples/scaling_video.c b/doc/examples/scaling_video.c
index fcb98b7489a0a45722b8dcdd60c69e3619426130..587f3abe4f1804dba02870241d871508fd960ff6 100644
--- a/doc/examples/scaling_video.c
+++ b/doc/examples/scaling_video.c
@@ -132,8 +132,7 @@ int main(int argc, char **argv)
            av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
 
 end:
-    if (dst_file)
-        fclose(dst_file);
+    fclose(dst_file);
     av_freep(&src_data[0]);
     av_freep(&dst_data[0]);
     sws_freeContext(sws_ctx);