svn commit: r259540 - head/lib/libstand
Marcel Moolenaar
marcel at FreeBSD.org
Wed Dec 18 04:52:30 UTC 2013
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)
More information about the svn-src-all
mailing list