Author: ngie
Date: Mon Jul 11 06:58:24 2016
New Revision: 302550
URL: https://svnweb.freebsd.org/changeset/base/302550

Log:
  Deobfuscate cleanup path in clnt_dg_create(..)
  
  Similar to r300836 and r301800, cl and cu 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
  cu was not, cu would not be free'd, and also removes a duplicate test for
  cl not being NULL.
  
  MFC after: 1 week
  Reported by: Coverity
  CID: 1007033, 1007344
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/rpc/clnt_dg.c

Modified: head/sys/rpc/clnt_dg.c
==============================================================================
--- head/sys/rpc/clnt_dg.c      Mon Jul 11 06:55:02 2016        (r302549)
+++ head/sys/rpc/clnt_dg.c      Mon Jul 11 06:58:24 2016        (r302550)
@@ -313,11 +313,9 @@ recheck_socket:
        cl->cl_netid = NULL;
        return (cl);
 err2:
-       if (cl) {
-               mem_free(cl, sizeof (CLIENT));
-               if (cu)
-                       mem_free(cu, sizeof (*cu));
-       }
+       mem_free(cl, sizeof (CLIENT));
+       mem_free(cu, sizeof (*cu));
+
        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