Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/lib/libc/stdio Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/284c1e1014a5
branches:  netbsd-7
changeset: 800048:284c1e1014a5
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Dec 12 07:23:46 2016 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1303):
        lib/libc/stdio/funopen.c: revision 1.15
PR/51572: calling funopen on each printw call is a tad excessive, but this
is not a reason for funopen to leak. Always call the close function since we
are indirecting through our cookie and we need to free it.

diffstat:

 lib/libc/stdio/funopen.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r ece0b5bace54 -r 284c1e1014a5 lib/libc/stdio/funopen.c
--- a/lib/libc/stdio/funopen.c  Mon Dec 12 07:18:29 2016 +0000
+++ b/lib/libc/stdio/funopen.c  Mon Dec 12 07:23:46 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: funopen.c,v 1.14 2012/03/28 15:21:11 christos Exp $    */
+/*     $NetBSD: funopen.c,v 1.14.10.1 2016/12/12 07:23:46 snj Exp $    */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)funopen.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: funopen.c,v 1.14 2012/03/28 15:21:11 christos Exp $");
+__RCSID("$NetBSD: funopen.c,v 1.14.10.1 2016/12/12 07:23:46 snj Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -138,6 +138,8 @@
        void *c = d->cookie;
        int (*cf)(void *) = d->closefn;
        free(dookie);
+       if (cf == NULL)
+               return 0;
        return (*cf)(c);
 }
 
@@ -163,8 +165,7 @@
            d->readfn ? creadfn : NULL,
            d->writefn ? cwritefn : NULL,
            d->seekfn ? cseekfn : NULL,
-           NULL,
-           d->closefn ? cclosefn : NULL);
+           NULL, cclosefn);
        if (fp != NULL)
                return fp;
        free(d);



Home | Main Index | Thread Index | Old Index