Run memset only after having checked the return of malloc
Submitted by: pluknet
This commit is contained in:
parent
6cdc211add
commit
e12838d367
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290500
@ -1256,11 +1256,11 @@ dump_collate(void)
|
||||
*/
|
||||
RB_NUMNODES(collchar_t, collchars, &collchars, n);
|
||||
large = malloc(sizeof (collate_large_t) * n);
|
||||
memset(large, 0, sizeof (collate_large_t) * n);
|
||||
if (large == NULL) {
|
||||
fprintf(stderr, "out of memory");
|
||||
return;
|
||||
}
|
||||
memset(large, 0, sizeof (collate_large_t) * n);
|
||||
|
||||
i = 0;
|
||||
RB_FOREACH(cc, collchars, &collchars) {
|
||||
|
Loading…
Reference in New Issue
Block a user