diff options
author | ed <ed@FreeBSD.org> | 2010-04-11 12:07:03 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-04-11 12:07:03 +0000 |
commit | 22858658af4aa248638b9368d74ebd0b9779a046 (patch) | |
tree | a3074f7504503c32f5d2659a0a9f308f8a3b34ba /usr.sbin/lastlogin | |
parent | dabdbe3adaca80897f154c0a79f2e571e20571d0 (diff) | |
download | FreeBSD-src-22858658af4aa248638b9368d74ebd0b9779a046.zip FreeBSD-src-22858658af4aa248638b9368d74ebd0b9779a046.tar.gz |
Don't forget to catch realloc() errors.
Diffstat (limited to 'usr.sbin/lastlogin')
-rw-r--r-- | usr.sbin/lastlogin/lastlogin.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/lastlogin/lastlogin.c b/usr.sbin/lastlogin/lastlogin.c index 9c3d433..4c08547 100644 --- a/usr.sbin/lastlogin/lastlogin.c +++ b/usr.sbin/lastlogin/lastlogin.c @@ -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(); |