Module Name: src
Committed By: christos
Date: Sun Sep 21 16:56:44 UTC 2014
Modified Files:
src/sys/arch/xen/xen: privcmd.c
Log Message:
fix leak.
To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/xen/privcmd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.46 src/sys/arch/xen/xen/privcmd.c:1.47
--- src/sys/arch/xen/xen/privcmd.c:1.46 Sun Sep 21 12:53:38 2014
+++ src/sys/arch/xen/xen/privcmd.c Sun Sep 21 12:56:44 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.46 2014/09/21 16:53:38 christos Exp $ */
+/* $NetBSD: privcmd.c,v 1.47 2014/09/21 16:56:44 christos Exp $ */
/*-
* Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.46 2014/09/21 16:53:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.47 2014/09/21 16:56:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -556,7 +556,7 @@ privcmd_map_obj(struct vm_map *map, vadd
/* remove current entries */
uvm_unmap1(map, start, start + size, 0);
- obj = kmem_alloc(sizeof(struct privcmd_object), KM_SLEEP);
+ obj = kmem_alloc(sizeof(*obj), KM_SLEEP);
if (obj == NULL) {
kmem_free(maddr, sizeof(paddr_t) * npages);
return ENOMEM;
@@ -576,6 +576,8 @@ privcmd_map_obj(struct vm_map *map, vadd
if (error) {
if (obj)
obj->uobj.pgops->pgo_detach(&obj->uobj);
+ kmem_free(maddr, sizeof(paddr_t) * npages);
+ kmem_free(obj, sizeof(*obj));
return error;
}
if (newstart != start) {