Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xen fix leak.



details:   https://anonhg.NetBSD.org/src/rev/b6d88b3b0523
branches:  trunk
changeset: 802594:b6d88b3b0523
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Sep 21 16:56:44 2014 +0000

description:
fix leak.

diffstat:

 sys/arch/xen/xen/privcmd.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r bf8bb67fd135 -r b6d88b3b0523 sys/arch/xen/xen/privcmd.c
--- a/sys/arch/xen/xen/privcmd.c        Sun Sep 21 16:53:38 2014 +0000
+++ b/sys/arch/xen/xen/privcmd.c        Sun Sep 21 16:56:44 2014 +0000
@@ -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 @@
        /* 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 @@
        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) {



Home | Main Index | Thread Index | Old Index