diff options
| author | kre <kre@NetBSD.org> | 2022-03-13 01:44:37 +0000 |
|---|---|---|
| committer | kre <kre@NetBSD.org> | 2022-03-13 01:44:37 +0000 |
| commit | 6e57ea7f3e3d5cf034579cc53ec2a99dfd6ecf08 (patch) | |
| tree | d63d284f6435ff8cc6047315c0fc75271940b2bf /lib/libc/stdlib | |
| parent | 1cece220b3907ceb84cd1bf64a95c0f9e2d4d0d5 (diff) | |
Avoid referencing uninit'd memory.
Diffstat (limited to 'lib/libc/stdlib')
| -rw-r--r-- | lib/libc/stdlib/hcreate.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdlib/hcreate.c b/lib/libc/stdlib/hcreate.c index be94e531bc3..3c914a76c76 100644 --- a/lib/libc/stdlib/hcreate.c +++ b/lib/libc/stdlib/hcreate.c @@ -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 @@ hcreate_r(size_t nel, struct hsearch_data *head) /* Allocate the table. */ head->size = nel; head->filled = 0; + table = NULL; errno = reallocarr(&table, nel, sizeof(*table)); if (errno) return 0; |
