Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2014 15:48:45 +0000 (UTC)
From:      Christian Brueffer <brueffer@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: r266243 - in stable/10: lib/libc/rpc sys/rpc
Message-ID:  <201405161548.s4GFmjY0013656@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brueffer
Date: Fri May 16 15:48:45 2014
New Revision: 266243
URL: http://svnweb.freebsd.org/changeset/base/266243

Log:
  MFC: r265238, r265240
  
  Properly free resources in case of error.
  
  CID:		1007032
  Found with:	Coverity Prevent(tm)

Modified:
  stable/10/lib/libc/rpc/clnt_vc.c
  stable/10/sys/rpc/clnt_vc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/rpc/clnt_vc.c
==============================================================================
--- stable/10/lib/libc/rpc/clnt_vc.c	Fri May 16 15:46:28 2014	(r266242)
+++ stable/10/lib/libc/rpc/clnt_vc.c	Fri May 16 15:48:45 2014	(r266243)
@@ -301,15 +301,13 @@ clnt_vc_create(fd, raddr, prog, vers, se
 	return (cl);
 
 err:
-	if (cl) {
-		if (ct) {
-			if (ct->ct_addr.len)
-				mem_free(ct->ct_addr.buf, ct->ct_addr.len);
-			mem_free(ct, sizeof (struct ct_data));
-		}
-		if (cl)
-			mem_free(cl, sizeof (CLIENT));
+	if (ct) {
+		if (ct->ct_addr.len)
+			mem_free(ct->ct_addr.buf, ct->ct_addr.len);
+		mem_free(ct, sizeof (struct ct_data));
 	}
+	if (cl)
+		mem_free(cl, sizeof (CLIENT));
 	return ((CLIENT *)NULL);
 }
 

Modified: stable/10/sys/rpc/clnt_vc.c
==============================================================================
--- stable/10/sys/rpc/clnt_vc.c	Fri May 16 15:46:28 2014	(r266242)
+++ stable/10/sys/rpc/clnt_vc.c	Fri May 16 15:48:45 2014	(r266243)
@@ -270,14 +270,12 @@ clnt_vc_create(
 	return (cl);
 
 err:
-	if (cl) {
-		if (ct) {
-			mtx_destroy(&ct->ct_lock);
-			mem_free(ct, sizeof (struct ct_data));
-		}
-		if (cl)
-			mem_free(cl, sizeof (CLIENT));
+	if (ct) {
+		mtx_destroy(&ct->ct_lock);
+		mem_free(ct, sizeof (struct ct_data));
 	}
+	if (cl)
+		mem_free(cl, sizeof (CLIENT));
 	return ((CLIENT *)NULL);
 }
 



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