svn commit: r206472 - head/usr.sbin/lastlogin
Ed Schouten
ed at FreeBSD.org
Sun Apr 11 12:07:04 UTC 2010
Author: ed
Date: Sun Apr 11 12:07:03 2010
New Revision: 206472
URL: http://svn.freebsd.org/changeset/base/206472
Log:
Don't forget to catch realloc() errors.
Modified:
head/usr.sbin/lastlogin/lastlogin.c
Modified: head/usr.sbin/lastlogin/lastlogin.c
==============================================================================
--- head/usr.sbin/lastlogin/lastlogin.c Sun Apr 11 12:02:13 2010 (r206471)
+++ head/usr.sbin/lastlogin/lastlogin.c Sun Apr 11 12:07:03 2010 (r206472)
@@ -88,9 +88,12 @@ main(int argc, char *argv[])
while ((u = getutxent()) != NULL) {
if (u->ut_type != USER_PROCESS)
continue;
- if ((ulistsize % 16) == 0)
+ if ((ulistsize % 16) == 0) {
ulist = realloc(ulist,
(ulistsize + 16) * sizeof(struct utmpx));
+ if (ulist == NULL)
+ err(1, "malloc");
+ }
ulist[ulistsize++] = *u;
}
endutxent();
More information about the svn-src-all
mailing list