diff options
author | pfg <pfg@FreeBSD.org> | 2015-02-20 01:02:32 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2015-02-20 01:02:32 +0000 |
commit | aef2a8879198b292401276632f93402f2c715a14 (patch) | |
tree | 771c676c1543bc516befceacf3abc7ab60fb0b4d /lib/libc/gen/getpwent.c | |
parent | c0ae6c2127580cca43ae3425615b6e3dd2459984 (diff) | |
download | FreeBSD-src-aef2a8879198b292401276632f93402f2c715a14.zip FreeBSD-src-aef2a8879198b292401276632f93402f2c715a14.tar.gz |
Fix small memleaks in nis_passwd() and nis_group().
These only occur upon error.
Code Review: https://reviews.freebsd.org/D1849
Reviewed by: delphij
CID: 1016715
CID: 1016717
Diffstat (limited to 'lib/libc/gen/getpwent.c')
-rw-r--r-- | lib/libc/gen/getpwent.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 6cd7eaf..0cb8ed2 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1392,8 +1392,10 @@ nis_passwd(void *retval, void *mdata, va_list ap) continue; } } - if (resultlen >= bufsize) + if (resultlen >= bufsize) { + free(result); goto erange; + } memcpy(buffer, result, resultlen); buffer[resultlen] = '\0'; free(result); |