bios_table: pldm_bios_table_iter_create(): Return NULL on failed alloc
Given we're already returning the pointer, take the opportunity to
return a NULL pointer if the allocation fails. This provides a signal to
the caller that an error has occurred and allows us to escape from
relying on assert() as the signal.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I58a82a240e64f981c28ad69e317ac8e3d1e41d40
diff --git a/src/bios_table.c b/src/bios_table.c
index 2605e40..910a499 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -961,6 +961,9 @@
{
struct pldm_bios_table_iter *iter = malloc(sizeof(*iter));
assert(iter != NULL);
+ if (!iter) {
+ return NULL;
+ }
iter->table_data = table;
iter->table_len = length;
iter->current_pos = 0;