svn commit: r301921 - stable/10/lib/libc/gen
Don Lewis
truckman at FreeBSD.org
Wed Jun 15 06:42:31 UTC 2016
Author: truckman
Date: Wed Jun 15 06:42:30 2016
New Revision: 301921
URL: https://svnweb.freebsd.org/changeset/base/301921
Log:
MFC r301596
Don't leak olinep if malloc() fails.
If malloc() fails to allocate linep, then free olinep (if it exists)
before returning to avoid a memory leak.
Reported by: Coverity
CID: 1016716
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D6755
Modified:
stable/10/lib/libc/gen/getnetgrent.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/lib/libc/gen/getnetgrent.c
==============================================================================
--- stable/10/lib/libc/gen/getnetgrent.c Wed Jun 15 06:40:30 2016 (r301920)
+++ stable/10/lib/libc/gen/getnetgrent.c Wed Jun 15 06:42:30 2016 (r301921)
@@ -615,6 +615,8 @@ read_for_group(const char *group)
if (linep == NULL) {
free(lp->l_groupname);
free(lp);
+ if (olen > 0)
+ free(olinep);
return (NULL);
}
if (olen > 0) {
More information about the svn-src-stable-10
mailing list