Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdlib Avoid referencing uninit'd memory.



details:   https://anonhg.NetBSD.org/src/rev/092421068a3c
branches:  trunk
changeset: 363454:092421068a3c
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Mar 13 01:44:37 2022 +0000

description:
Avoid referencing uninit'd memory.

diffstat:

 lib/libc/stdlib/hcreate.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r d560abf98dba -r 092421068a3c lib/libc/stdlib/hcreate.c
--- a/lib/libc/stdlib/hcreate.c Sat Mar 12 22:20:34 2022 +0000
+++ b/lib/libc/stdlib/hcreate.c Sun Mar 13 01:44:37 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hcreate.c,v 1.12 2022/03/12 17:31:39 christos Exp $ */
+/* $NetBSD: hcreate.c,v 1.13 2022/03/13 01:44:37 kre Exp $ */
 
 /*
  * Copyright (c) 2001 Christopher G. Demetriou
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: hcreate.c,v 1.12 2022/03/12 17:31:39 christos Exp $");
+__RCSID("$NetBSD: hcreate.c,v 1.13 2022/03/13 01:44:37 kre Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #if !defined(lint)
@@ -124,6 +124,7 @@
        /* Allocate the table. */
        head->size = nel;
        head->filled = 0;
+       table = NULL;
        errno = reallocarr(&table, nel, sizeof(*table));
        if (errno)
                return 0;



Home | Main Index | Thread Index | Old Index