Allocate adjusted size, not fixed size.

This commit is contained in:
atatat 2004-04-23 12:03:39 +00:00
parent d26290d280
commit a929f1c4f7
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.c,v 1.92 2004/04/22 03:56:31 atatat Exp $ */
/* $NetBSD: sysctl.c,v 1.93 2004/04/23 12:03:39 atatat Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -72,7 +72,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: sysctl.c,v 1.92 2004/04/22 03:56:31 atatat Exp $");
__RCSID("$NetBSD: sysctl.c,v 1.93 2004/04/23 12:03:39 atatat Exp $");
#endif
#endif /* not lint */
@ -1456,7 +1456,7 @@ getdesc(int *name, u_int namelen, struct sysctlnode *pnode)
*/
i = 0;
do {
d = malloc(128 * pnode->sysctl_clen);
d = malloc(sz);
if (d == NULL)
return;
rc = sysctl(name, namelen + 1, d, &sz, NULL, 0);