kobj_read: plug a leak.
This commit is contained in:
parent
4d0ec49dcd
commit
1b31761afa
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr_kobj.c,v 1.21 2008/05/20 19:20:38 ad Exp $ */
|
||||
/* $NetBSD: subr_kobj.c,v 1.22 2008/10/06 10:46:58 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -62,7 +62,7 @@
|
|||
#include "opt_modular.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.21 2008/05/20 19:20:38 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.22 2008/10/06 10:46:58 ad Exp $");
|
||||
|
||||
#define ELFSIZE ARCH_ELFSIZE
|
||||
|
||||
|
@ -1024,9 +1024,12 @@ kobj_read(kobj_t ko, void **basep, size_t size, off_t off)
|
|||
UIO_SYSSPACE, IO_NODELOCKED, curlwp->l_cred, &resid,
|
||||
curlwp);
|
||||
if (error == 0 && resid != 0) {
|
||||
kmem_free(base, size);
|
||||
error = EINVAL;
|
||||
}
|
||||
if (error != 0) {
|
||||
kmem_free(base, size);
|
||||
base = NULL;
|
||||
}
|
||||
break;
|
||||
case KT_MEMORY:
|
||||
if (ko->ko_memsize != -1 && off + size > ko->ko_memsize) {
|
||||
|
|
Loading…
Reference in New Issue