accounting.c: add missing alloc checks
because CONFIG_ACCOUNTING is not meant for production code, we simply
abort on allocation failure
Bug: aomedia:3276
Change-Id: Ic1cb8e1973d1d1798dabd33ee0a387a26c23a99c
diff --git a/av1/decoder/accounting.c b/av1/decoder/accounting.c
index 2e58d09..1ded380 100644
--- a/av1/decoder/accounting.c
+++ b/av1/decoder/accounting.c
@@ -47,6 +47,7 @@
accounting->hash_dictionary[hash] = dictionary->num_strs;
len = strlen(str);
dictionary->strs[dictionary->num_strs] = malloc(len + 1);
+ if (!dictionary->strs[dictionary->num_strs]) abort();
snprintf(dictionary->strs[dictionary->num_strs], len + 1, "%s", str);
dictionary->num_strs++;
return dictionary->num_strs - 1;
@@ -57,6 +58,7 @@
accounting->num_syms_allocated = 1000;
accounting->syms.syms =
malloc(sizeof(AccountingSymbol) * accounting->num_syms_allocated);
+ if (!accounting->syms.syms) abort();
accounting->syms.dictionary.num_strs = 0;
assert(AOM_ACCOUNTING_HASH_SIZE > 2 * MAX_SYMBOL_TYPES);
for (i = 0; i < AOM_ACCOUNTING_HASH_SIZE; i++)
@@ -116,7 +118,7 @@
accounting->syms.syms =
realloc(accounting->syms.syms,
sizeof(AccountingSymbol) * accounting->num_syms_allocated);
- assert(accounting->syms.syms != NULL);
+ if (!accounting->syms.syms) abort();
}
accounting->syms.syms[accounting->syms.num_syms++] = sym;
}