Use *array() allocation functions where appropriate
This prevents overflow from multiplication. Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
727275a027
commit
191f04f7dc
@@ -635,7 +635,7 @@ commonio_sort (struct commonio_db *db, int (*cmp) (const void *, const void *))
|
||||
return 0;
|
||||
}
|
||||
|
||||
entries = malloc (n * sizeof (struct commonio_entry *));
|
||||
entries = mallocarray (n, sizeof (struct commonio_entry *));
|
||||
if (entries == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user