Run memset only after having checked the return of malloc

Submitted by:	pluknet
This commit is contained in:
Baptiste Daroussin 2015-11-07 16:45:51 +00:00
parent 6cdc211add
commit e12838d367
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290500

View File

@ -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) {