MdeModulePkg: Add NULL pointer check for RegularExpressionDxe.
Refine code by adding NULL pointer check to avoid potential NULL pointer dereferenced. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19271 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -156,6 +156,7 @@ st_init_table_with_size(type, size)
|
||||
size = new_size(size); /* round up to prime number */
|
||||
|
||||
tbl = alloc(st_table);
|
||||
CHECK_NULL_RETURN(tbl);
|
||||
tbl->type = type;
|
||||
tbl->num_entries = 0;
|
||||
tbl->num_bins = size;
|
||||
@@ -267,6 +268,9 @@ do {\
|
||||
}\
|
||||
\
|
||||
entry = alloc(st_table_entry);\
|
||||
if (entry == NULL) {\
|
||||
break;\
|
||||
}\
|
||||
\
|
||||
entry->hash = hash_val;\
|
||||
entry->key = key;\
|
||||
@@ -321,6 +325,9 @@ rehash(table)
|
||||
|
||||
new_num_bins = new_size(old_num_bins+1);
|
||||
new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
|
||||
if (new_bins == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < old_num_bins; i++) {
|
||||
ptr = table->bins[i];
|
||||
|
Reference in New Issue
Block a user