[PATCH][V2] fwts_summary: check for list creation failure
Colin King
colin.king at canonical.com
Mon Jun 10 10:12:20 UTC 2019
From: Colin Ian King <colin.king at canonical.com>
Check for null pointer when creating a new list.
Addresses-Coverity: ("Dereference null return")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_summary.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c
index 625dcd2d..041df5ad 100644
--- a/src/lib/src/fwts_summary.c
+++ b/src/lib/src/fwts_summary.c
@@ -233,6 +233,11 @@ int fwts_summary_report(fwts_framework *fw, fwts_list *test_list)
fwts_list_link *item;
fwts_list *sorted = fwts_list_new();
+ if (!sorted) {
+ fwts_log_error(fw, "Out of memory allocating test summary list");
+ return FWTS_ERROR;
+ }
+
fwts_list_foreach(item, test_list)
fwts_list_add_ordered(sorted, fwts_list_data(fwts_framework_test *,item), fwts_framework_compare_test_name);
--
2.20.1
More information about the fwts-devel
mailing list