Date: Wed, 15 Jun 2016 06:42:30 +0000 (UTC) From: Don Lewis <truckman@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r301921 - stable/10/lib/libc/gen Message-ID: <201606150642.u5F6gU4U029293@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606150642.u5F6gU4U029293>