Author: marcel
Date: Wed Dec 18 04:52:30 2013
New Revision: 259540
URL: http://svnweb.freebsd.org/changeset/base/259540

Log:
  Clear f_rabuf after freeing the memory it points to. This prevents a
  possible double free.
  
  Obtained from:        Juniper Networks, Inc.

Modified:
  head/lib/libstand/close.c

Modified: head/lib/libstand/close.c
==============================================================================
--- head/lib/libstand/close.c   Wed Dec 18 04:44:38 2013        (r259539)
+++ head/lib/libstand/close.c   Wed Dec 18 04:52:30 2013        (r259540)
@@ -75,8 +75,10 @@ close(int fd)
        errno = EBADF;
        return (-1);
     }
-    if (f->f_rabuf != NULL)
+    if (f->f_rabuf != NULL) {
        free(f->f_rabuf);
+       f->f_rabuf = NULL;
+    }
     if (!(f->f_flags & F_RAW) && f->f_ops)
        err1 = (f->f_ops->fo_close)(f);
     if (!(f->f_flags & F_NODEV) && f->f_dev)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to