Klocwork: Fix the Null pointer derefernce found by klocwork

Signed-off-by: Thejaswani Putta <thejaswani.putta@intel.com>
Change-Id: I15973ac28e9645826986cf63d2160eedb83024e4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32290
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Lijian Zhao <lijian.zhao@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Thejaswani Putta
2019-04-11 18:36:08 -07:00
committed by Patrick Georgi
parent 21f9b3ecd7
commit 6f5225c7e0
3 changed files with 14 additions and 3 deletions

View File

@@ -14,6 +14,7 @@
*/
#include "cbfs_sections.h"
#include "common.h"
#include <assert.h>
#include <stdlib.h>
@@ -65,6 +66,10 @@ bool fmd_process_flag_cbfs(const struct flashmap_descriptor *node)
return false;
list_node = (struct descriptor_node *)malloc(sizeof(*list_node));
if (!list_node) {
ERROR("Cannot allocate CBFS flag node!\n");
return false;
}
list_node->val = node;
list_node->next = NULL;