Source-Changes-HG archive

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

[src/netbsd-3]: src/lib/libc/gen Pull up revision 1.4 (requested by lukem in ...



details:   https://anonhg.NetBSD.org/src/rev/e48cc6681365
branches:  netbsd-3
changeset: 576183:e48cc6681365
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jun 11 12:15:25 2005 +0000

description:
Pull up revision 1.4 (requested by lukem in ticket #394):
Ensure that we don't try to free random memory when another malloc fails,
by initializing newprepare, newparent, and newchild to NULL.
Detected by gcc -Wuninitialized.

diffstat:

 lib/libc/gen/pthread_atfork.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r d5912ad78104 -r e48cc6681365 lib/libc/gen/pthread_atfork.c
--- a/lib/libc/gen/pthread_atfork.c     Sat Jun 11 12:13:55 2005 +0000
+++ b/lib/libc/gen/pthread_atfork.c     Sat Jun 11 12:15:25 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_atfork.c,v 1.3 2004/10/21 06:46:36 lukem Exp $ */
+/*     $NetBSD: pthread_atfork.c,v 1.3.2.1 2005/06/11 12:15:25 tron Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: pthread_atfork.c,v 1.3 2004/10/21 06:46:36 lukem Exp $");
+__RCSID("$NetBSD: pthread_atfork.c,v 1.3.2.1 2005/06/11 12:15:25 tron Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #define __LIBC12_SOURCE__
@@ -82,6 +82,8 @@
 {
        struct atfork_callback *newprepare, *newparent, *newchild;
 
+       newprepare = newparent = newchild = NULL;
+
        if (prepare != NULL) {
                newprepare = malloc(sizeof(struct atfork_callback));
                if (newprepare == NULL)



Home | Main Index | Thread Index | Old Index