Author: cem
Date: Wed May 11 22:33:20 2016
New Revision: 299491
URL: https://svnweb.freebsd.org/changeset/base/299491

Log:
  route6d(8): Fix potential double-free
  
  In the case that the subsequent sysctl(3) call failed, 'buf' could be 
free(3)ed
  repeatedly.  It isn't clear to me that that case is possible, but be clear and
  do the right thing in case it is.
  
  Reported by:  Coverity
  CID:          272537
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/usr.sbin/route6d/route6d.c

Modified: head/usr.sbin/route6d/route6d.c
==============================================================================
--- head/usr.sbin/route6d/route6d.c     Wed May 11 22:25:14 2016        
(r299490)
+++ head/usr.sbin/route6d/route6d.c     Wed May 11 22:33:20 2016        
(r299491)
@@ -2598,8 +2598,10 @@ krtread(int again)
                        sleep(1);
                retry++;
                errmsg = NULL;
-               if (buf)
+               if (buf) {
                        free(buf);
+                       buf = NULL;
+               }
                if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
                        errmsg = "sysctl estimate";
                        continue;
_______________________________________________
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