Module Name: src
Committed By: riastradh
Date: Sun Dec 15 11:34:14 UTC 2024
Modified Files:
src/lib/libpthread: res_state.c
Log Message:
libpthread: Zero-initialize res_state objects.
PR lib/58888
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/res_state.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libpthread/res_state.c
diff -u src/lib/libpthread/res_state.c:1.7 src/lib/libpthread/res_state.c:1.8
--- src/lib/libpthread/res_state.c:1.7 Sat Feb 12 14:59:32 2022
+++ src/lib/libpthread/res_state.c Sun Dec 15 11:34:14 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: res_state.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $ */
+/* $NetBSD: res_state.c,v 1.8 2024/12/15 11:34:14 riastradh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: res_state.c,v 1.7 2022/02/12 14:59:32 riastradh Exp $");
+__RCSID("$NetBSD: res_state.c,v 1.8 2024/12/15 11:34:14 riastradh Exp $");
#endif
/* Need to use libc-private names for atomic operations. */
@@ -93,7 +93,7 @@ __res_get_state(void)
res_state_debug("checkout from list", st);
} else {
pthread_mutex_unlock(&res_mtx);
- st = malloc(sizeof(*st));
+ st = calloc(1, sizeof(*st));
if (st == NULL) {
h_errno = NETDB_INTERNAL;
return NULL;