Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2016 02:02:18 +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: r300386 - head/lib/libc/rpc
Message-ID:  <201605220202.u4M22IYe080750@repo.freebsd.org>

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

Log:
  Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new
  struct xlist object fails
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 978277
  Sponsored by: EMC / Isilon Storage Division

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

Modified: head/lib/libc/rpc/svc_generic.c
==============================================================================
--- head/lib/libc/rpc/svc_generic.c	Sun May 22 01:45:15 2016	(r300385)
+++ head/lib/libc/rpc/svc_generic.c	Sun May 22 02:02:18 2016	(r300386)
@@ -122,7 +122,8 @@ svc_create(void (*dispatch)(struct svc_r
 				if (l == NULL) {
 					warnx("svc_create: no memory");
 					mutex_unlock(&xprtlist_lock);
-					return (0);
+					num = 0;
+					goto done;
 				}
 				l->xprt = xprt;
 				l->next = xprtlist;
@@ -132,6 +133,7 @@ svc_create(void (*dispatch)(struct svc_r
 		}
 		mutex_unlock(&xprtlist_lock);
 	}
+done:
 	__rpc_endconf(handle);
 	/*
 	 * In case of num == 0; the error messages are generated by the



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