Move check for rnode being NULL to before it's first use.

Fixes Coverity CID 2434
This commit is contained in:
chris 2006-03-17 01:52:08 +00:00
parent f500b89c3d
commit caebf8211b
1 changed files with 5 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sysctl.c,v 1.191 2006/03/15 16:12:07 drochner Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.192 2006/03/17 01:52:08 chris Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.191 2006/03/15 16:12:07 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.192 2006/03/17 01:52:08 chris Exp $");
#include "opt_defcorename.h"
#include "opt_insecure.h"
@ -2333,13 +2333,14 @@ sysctl_free(struct sysctlnode *rnode)
{
struct sysctlnode *node, *pnode;
if (rnode == NULL)
rnode = &sysctl_root;
if (SYSCTL_VERS(rnode->sysctl_flags) != SYSCTL_VERSION) {
printf("sysctl_free: rnode %p wrong version\n", rnode);
return;
}
if (rnode == NULL)
rnode = &sysctl_root;
pnode = rnode;
node = pnode->sysctl_child;