Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2016 03:05:27 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300389 - head/lib/libc/rpc
Message-ID:  <201605220305.u4M35RTW099530@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun May 22 03:05:27 2016
New Revision: 300389
URL: https://svnweb.freebsd.org/changeset/base/300389

Log:
  nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)
  
  If the buffer couldn't be adequately resized to accomodate an additional "\n",
  it would leak resultbuf by breaking from the loop early
  
  MFC after: 2 weeks
  Reported by: Coverity
  CID: 1016702
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libc/rpc/getrpcent.c

Modified: head/lib/libc/rpc/getrpcent.c
==============================================================================
--- head/lib/libc/rpc/getrpcent.c	Sun May 22 02:53:11 2016	(r300388)
+++ head/lib/libc/rpc/getrpcent.c	Sun May 22 03:05:27 2016	(r300389)
@@ -511,6 +511,7 @@ nis_rpcent(void *retval, void *mdata, va
 		    sizeof(char *)) {
 			*errnop = ERANGE;
 			rv = NS_RETURN;
+			free(resultbuf);
 			break;
 		}
 
@@ -520,6 +521,7 @@ nis_rpcent(void *retval, void *mdata, va
 		if (aliases_size < 1) {
 			*errnop = ERANGE;
 			rv = NS_RETURN;
+			free(resultbuf);
 			break;
 		}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605220305.u4M35RTW099530>