Commit 0d4bddb983 for aom
commit 0d4bddb9831de540fbb6d66dab35594f77139ea5
Author: Wan-Teh Chang <wtc@google.com>
Date: Fri Jun 5 14:32:25 2026 -0700
Fix a potential leak in aom_film_grain_table_read
If grain_table_entry_read() calls aom_internal_error(), `entry` will be
leaked. To avoid this leak, add `entry` to `t` before calling
grain_table_entry_read().
Change-Id: I6d3e6948a62e1a5a33f62ebcda93763bce9ac33f
diff --git a/aom_dsp/grain_table.c b/aom_dsp/grain_table.c
index 38ca1e4712..91ef2b4bba 100644
--- a/aom_dsp/grain_table.c
+++ b/aom_dsp/grain_table.c
@@ -296,13 +296,14 @@ aom_codec_err_t aom_film_grain_table_read(
"Unable to allocate grain table entry");
}
memset(entry, 0, sizeof(*entry));
- grain_table_entry_read(file, error_info, entry);
entry->next = NULL;
if (prev_entry) prev_entry->next = entry;
if (!t->head) t->head = entry;
t->tail = entry;
prev_entry = entry;
+
+ grain_table_entry_read(file, error_info, entry);
}
}