Commit 37b465fae5 for aom

commit 37b465fae5807f222ba44491efc2f93c4683f93c
Author: James Zern <jzern@google.com>
Date:   Thu Jun 18 14:57:52 2026 -0700

    add missing fopen() return checks

    Fixes some clang-19 static analysis warnings of the form:

    ```
    Null pointer passed to 4th parameter expecting 'nonnull'
    ```

    Bug: 474642915
    Change-Id: I353a4d6cc2569b2cd741822e4854d27296ccb777

diff --git a/av1/common/debugmodes.c b/av1/common/debugmodes.c
index d9a96721af..667d98885c 100644
--- a/av1/common/debugmodes.c
+++ b/av1/common/debugmodes.c
@@ -96,6 +96,7 @@ void av1_print_modes_and_motion_vectors(AV1_COMMON *cm, const char *file) {
 void av1_print_uncompressed_frame_header(const uint8_t *data, int size,
                                          const char *filename) {
   FILE *hdrFile = fopen(filename, "w");
+  if (!hdrFile) return;
   fwrite(data, size, sizeof(uint8_t), hdrFile);

   // Reset order hints(7bit + a previous bit) to 0, so that all camera frame
@@ -109,6 +110,7 @@ void av1_print_uncompressed_frame_header(const uint8_t *data, int size,

 void av1_print_frame_contexts(const FRAME_CONTEXT *fc, const char *filename) {
   FILE *fcFile = fopen(filename, "w");
+  if (!fcFile) return;
   const uint16_t *fcp = (uint16_t *)fc;
   const unsigned int n_contexts = sizeof(FRAME_CONTEXT) / sizeof(uint16_t);
   unsigned int i;
diff --git a/av1/encoder/partition_strategy.c b/av1/encoder/partition_strategy.c
index 4b44ba4559..e3c4178d29 100644
--- a/av1/encoder/partition_strategy.c
+++ b/av1/encoder/partition_strategy.c
@@ -2469,6 +2469,7 @@ static void write_motion_feature_to_file(
   snprintf(filename, sizeof(filename), "%s/motion_search_feature_sb%d", path,
            sb_counter);
   FILE *pfile = fopen(filename, "w");
+  if (pfile == NULL) return;
   fprintf(pfile, "%d,%d,%d,%d,%d\n", mi_row, mi_col, bsize,
           block_size_wide[fixed_block_size], num_blocks);
   for (int i = 0; i < num_blocks; ++i) {
diff --git a/examples/lightfield_decoder.c b/examples/lightfield_decoder.c
index d77235fd1a..13945c5058 100644
--- a/examples/lightfield_decoder.c
+++ b/examples/lightfield_decoder.c
@@ -248,6 +248,10 @@ int main(int argc, char **argv) {
       snprintf(name, sizeof(name), "ref_%d.yuv", i);
       printf("writing ref image to %s, %u, %u\n", name, img->d_w, img->d_h);
       FILE *ref_file = fopen(name, "wb");
+      if (!ref_file) {
+        fprintf(stderr, "Unable to open ref_file '%s'\n", name);
+        continue;
+      }
       aom_img_write(img, ref_file);
       fclose(ref_file);
     }
diff --git a/examples/lightfield_tile_list_decoder.c b/examples/lightfield_tile_list_decoder.c
index dd6391e7ba..ead9c22560 100644
--- a/examples/lightfield_tile_list_decoder.c
+++ b/examples/lightfield_tile_list_decoder.c
@@ -186,6 +186,10 @@ int main(int argc, char **argv) {
       snprintf(name, sizeof(name), "ref_%d.yuv", i);
       printf("writing ref image to %s, %u, %u\n", name, img->d_w, img->d_h);
       FILE *ref_file = fopen(name, "wb");
+      if (!ref_file) {
+        fprintf(stderr, "Unable to open ref_file '%s'\n", name);
+        continue;
+      }
       aom_img_write(img, ref_file);
       fclose(ref_file);
     }