svn commit: r290500 - head/usr.bin/localedef
Baptiste Daroussin
bapt at FreeBSD.org
Sat Nov 7 16:45:53 UTC 2015
Author: bapt
Date: Sat Nov 7 16:45:51 2015
New Revision: 290500
URL: https://svnweb.freebsd.org/changeset/base/290500
Log:
Run memset only after having checked the return of malloc
Submitted by: pluknet
Modified:
head/usr.bin/localedef/collate.c
Modified: head/usr.bin/localedef/collate.c
==============================================================================
--- head/usr.bin/localedef/collate.c Sat Nov 7 16:22:29 2015 (r290499)
+++ head/usr.bin/localedef/collate.c Sat Nov 7 16:45:51 2015 (r290500)
@@ -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) {
More information about the svn-src-head
mailing list