svn commit: r300386 - head/lib/libc/rpc

Garrett Cooper ngie at FreeBSD.org
Sun May 22 02:02:19 UTC 2016


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


More information about the svn-src-head mailing list