Author: ngie
Date: Fri Jun 10 17:53:28 2016
New Revision: 301800
URL: https://svnweb.freebsd.org/changeset/base/301800

Log:
  Deobfuscate cleanup path in clnt_bck_create(..)
  
  Similar to r300836, cl and ct will always be non-NULL as they're allocated
  using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`.
  
  Deobfuscating the cleanup path fixes a leak where if cl was NULL and
  ct was not, ct would not be free'd, and also removes a duplicate test for
  cl not being NULL.
  
  Approved by: re (gjb)
  Differential Revision: https://reviews.freebsd.org/D6801
  MFC after: 1 week
  Reported by: Coverity
  CID: 1229999
  Reviewed by: cem
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/clnt_bck.c

Modified: head/sys/rpc/clnt_bck.c
==============================================================================
--- head/sys/rpc/clnt_bck.c     Fri Jun 10 15:47:20 2016        (r301799)
+++ head/sys/rpc/clnt_bck.c     Fri Jun 10 17:53:28 2016        (r301800)
@@ -175,14 +175,9 @@ clnt_bck_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));
-       }
+       mtx_destroy(&ct->ct_lock);
+       mem_free(ct, sizeof (struct ct_data));
+       mem_free(cl, sizeof (CLIENT));
        return (NULL);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to