Module Name:    src
Committed By:   snj
Date:           Mon Nov 10 17:59:57 UTC 2014

Modified Files:
        src/sys/arch/arm/iomd [netbsd-7]: iomd_irqhandler.c
        src/sys/arch/arm/ofw [netbsd-7]: ofw_irqhandler.c
        src/sys/arch/atari/atari [netbsd-7]: intr.c
        src/sys/arch/ews4800mips/sbd [netbsd-7]: fb_sbdio.c
        src/sys/arch/hpcmips/tx [netbsd-7]: tx39icu.c
        src/sys/arch/shark/isa [netbsd-7]: isa_irqhandler.c
        src/sys/arch/sparc/sparc [netbsd-7]: machdep.c
        src/sys/arch/sparc64/dev [netbsd-7]: psycho.c schizo.c
        src/sys/arch/sparc64/sparc64 [netbsd-7]: machdep.c
        src/sys/arch/sun68k/sun68k [netbsd-7]: bus.c
        src/sys/arch/x86/x86 [netbsd-7]: ipmi.c
        src/sys/arch/xen/xen [netbsd-7]: privcmd.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #195):
        sys/arch/arm/iomd/iomd_irqhandler.c: revision 1.21
        sys/arch/arm/ofw/ofw_irqhandler.c: revision 1.21
        sys/arch/atari/atari/intr.c: revision 1.24-1.25
        sys/arch/ews4800mips/sbd/fb_sbdio.c: revision 1.14
        sys/arch/hpcmips/tx/tx39icu.c: revision 1.34
        sys/arch/shark/isa/isa_irqhandler.c: revision 1.27
        sys/arch/sparc/sparc/machdep.c: revision 1.327
        sys/arch/sparc64/dev/psycho.c: revision 1.119
        sys/arch/sparc64/dev/schizo.c: revision 1.32
        sys/arch/sparc64/sparc64/machdep.c: revision 1.279
        sys/arch/sun68k/sun68k/bus.c: revision 1.22
        sys/arch/x86/x86/ipmi.c: revision 1.58
        sys/arch/xen/xen/privcmd.c: revision 1.46-1.49
Fix several memory leaks.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/arch/arm/iomd/iomd_irqhandler.c
cvs rdiff -u -r1.20 -r1.20.2.1 src/sys/arch/arm/ofw/ofw_irqhandler.c
cvs rdiff -u -r1.23 -r1.23.34.1 src/sys/arch/atari/atari/intr.c
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/ews4800mips/sbd/fb_sbdio.c
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/arch/hpcmips/tx/tx39icu.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/shark/isa/isa_irqhandler.c
cvs rdiff -u -r1.326 -r1.326.4.1 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.118 -r1.118.4.1 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.31 -r1.31.8.1 src/sys/arch/sparc64/dev/schizo.c
cvs rdiff -u -r1.278.2.1 -r1.278.2.2 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.21 -r1.21.60.1 src/sys/arch/sun68k/sun68k/bus.c
cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/arch/x86/x86/ipmi.c
cvs rdiff -u -r1.45 -r1.45.4.1 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/arm/iomd/iomd_irqhandler.c
diff -u src/sys/arch/arm/iomd/iomd_irqhandler.c:1.20 src/sys/arch/arm/iomd/iomd_irqhandler.c:1.20.4.1
--- src/sys/arch/arm/iomd/iomd_irqhandler.c:1.20	Wed Mar 26 19:44:51 2014
+++ src/sys/arch/arm/iomd/iomd_irqhandler.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: iomd_irqhandler.c,v 1.20 2014/03/26 19:44:51 christos Exp $	*/
+/*	$NetBSD: iomd_irqhandler.c,v 1.20.4.1 2014/11/10 17:59:56 snj Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.20 2014/03/26 19:44:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd_irqhandler.c,v 1.20.4.1 2014/11/10 17:59:56 snj Exp $");
 
 #include "opt_irqstats.h"
 
@@ -356,8 +356,10 @@ intr_claim(int irq, int level, const cha
 	ih->ih_arg = ih_arg;
 	ih->ih_flags = 0;
 
-	if (irq_claim(irq, ih) != 0)
+	if (irq_claim(irq, ih) != 0) {
+		free(ih, M_DEVBUF);
 		return NULL;
+	}
 	return ih;
 }
 

Index: src/sys/arch/arm/ofw/ofw_irqhandler.c
diff -u src/sys/arch/arm/ofw/ofw_irqhandler.c:1.20 src/sys/arch/arm/ofw/ofw_irqhandler.c:1.20.2.1
--- src/sys/arch/arm/ofw/ofw_irqhandler.c:1.20	Fri Jun 20 13:17:59 2014
+++ src/sys/arch/arm/ofw/ofw_irqhandler.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_irqhandler.c,v 1.20 2014/06/20 13:17:59 joerg Exp $	*/
+/*	$NetBSD: ofw_irqhandler.c,v 1.20.2.1 2014/11/10 17:59:56 snj Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_irqhandler.c,v 1.20 2014/06/20 13:17:59 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_irqhandler.c,v 1.20.2.1 2014/11/10 17:59:56 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -301,8 +301,10 @@ intr_claim(int irq, int level, int (*ih_
 	ih->ih_arg = ih_arg;
 	ih->ih_flags = 0;
 
-	if (irq_claim(irq, ih, group, name) != 0)
+	if (irq_claim(irq, ih, group, name) != 0) {
+		free(ih, M_DEVBUF);
 		return(NULL);
+	}
 	return(ih);
 }
 

Index: src/sys/arch/atari/atari/intr.c
diff -u src/sys/arch/atari/atari/intr.c:1.23 src/sys/arch/atari/atari/intr.c:1.23.34.1
--- src/sys/arch/atari/atari/intr.c:1.23	Mon Dec 20 00:25:30 2010
+++ src/sys/arch/atari/atari/intr.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $	*/
+/*	$NetBSD: intr.c,v 1.23.34.1 2014/11/10 17:59:56 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.23 2010/12/20 00:25:30 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.23.34.1 2014/11/10 17:59:56 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -132,21 +132,25 @@ intr_establish(int vector, int type, int
 	 */
 	switch (type & (AUTO_VEC|USER_VEC)) {
 	case AUTO_VEC:
-		if (vector < AVEC_MIN || vector > AVEC_MAX)
+		if (vector < AVEC_MIN || vector > AVEC_MAX) {
+			free(ih, M_DEVBUF);
 			return NULL;
+		}
 		vec_list = &autovec_list[vector-1];
 		hard_vec = &autovects[vector-1];
 		ih->ih_intrcnt = &intrcnt_auto[vector-1];
 		break;
 	case USER_VEC:
-		if (vector < UVEC_MIN || vector > UVEC_MAX)
+		if (vector < UVEC_MIN || vector > UVEC_MAX) {
+			free(ih, M_DEVBUF);
 			return NULL;
+		}
 		vec_list = &uservec_list[vector];
 		hard_vec = &uservects[vector];
 		ih->ih_intrcnt = &intrcnt_user[vector];
 		break;
 	default:
-		printf("intr_establish: bogus vector type\n");
+		printf("%s: bogus vector type\n", __func__);
 		free(ih, M_DEVBUF);
 		return NULL;
 	}

Index: src/sys/arch/ews4800mips/sbd/fb_sbdio.c
diff -u src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.13 src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.13.4.1
--- src/sys/arch/ews4800mips/sbd/fb_sbdio.c:1.13	Fri Jan 31 15:41:48 2014
+++ src/sys/arch/ews4800mips/sbd/fb_sbdio.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fb_sbdio.c,v 1.13 2014/01/31 15:41:48 tsutsui Exp $	*/
+/*	$NetBSD: fb_sbdio.c,v 1.13.4.1 2014/11/10 17:59:56 snj Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define WIRED_FB_TLB
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.13 2014/01/31 15:41:48 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_sbdio.c,v 1.13.4.1 2014/11/10 17:59:56 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,6 +154,7 @@ fb_sbdio_attach(device_t parent, device_
 		ga = malloc(sizeof(struct ga), M_DEVBUF, M_NOWAIT | M_ZERO);
 		if (ga == NULL) {
 			printf(":can't allocate ga memory\n");
+			free(ri, M_DEVBUF);
 			return;
 		}
 		ga->reg_paddr = sa->sa_addr2;

Index: src/sys/arch/hpcmips/tx/tx39icu.c
diff -u src/sys/arch/hpcmips/tx/tx39icu.c:1.33 src/sys/arch/hpcmips/tx/tx39icu.c:1.33.4.1
--- src/sys/arch/hpcmips/tx/tx39icu.c:1.33	Wed Mar 26 17:53:36 2014
+++ src/sys/arch/hpcmips/tx/tx39icu.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $ */
+/*	$NetBSD: tx39icu.c,v 1.33.4.1 2014/11/10 17:59:56 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.33 2014/03/26 17:53:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.33.4.1 2014/11/10 17:59:56 snj Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -634,11 +634,9 @@ tx39_poll_establish(tx_chipset_tag_t tc,
 	s = splhigh();
 	sc = tc->tc_intrt;
 
-	if (!(p = malloc(sizeof(struct txpoll_entry), 
-	    M_DEVBUF, M_NOWAIT))) {
+	if (!(p = malloc(sizeof(*p), M_DEVBUF, M_NOWAIT | M_ZERO))) {
 		panic ("tx39_poll_establish: no memory.");
 	}
-	memset(p, 0, sizeof(struct txpoll_entry));
 
 	p->p_fun = ih_fun;
 	p->p_arg = ih_arg;
@@ -647,13 +645,13 @@ tx39_poll_establish(tx_chipset_tag_t tc,
 	if (!sc->sc_polling) {
 		tx39clock_alarm_set(tc, 33); /* 33 msec */
 		
-		if (!(sc->sc_poll_ih = 
-		    tx_intr_establish(
-			    tc, MAKEINTR(5, TX39_INTRSTATUS5_ALARMINT),
-			    IST_EDGE, level, tx39_poll_intr, sc)))  {
+		if (!(sc->sc_poll_ih = tx_intr_establish(
+		    tc, MAKEINTR(5, TX39_INTRSTATUS5_ALARMINT),
+		    IST_EDGE, level, tx39_poll_intr, sc)))  {
 			printf("tx39_poll_establish: can't hook\n");
 
 			splx(s);
+			free(p, M_DEVBUF);
 			return (0);
 		}
 	}

Index: src/sys/arch/shark/isa/isa_irqhandler.c
diff -u src/sys/arch/shark/isa/isa_irqhandler.c:1.26 src/sys/arch/shark/isa/isa_irqhandler.c:1.26.4.1
--- src/sys/arch/shark/isa/isa_irqhandler.c:1.26	Sat Feb 22 18:56:25 2014
+++ src/sys/arch/shark/isa/isa_irqhandler.c	Mon Nov 10 17:59:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_irqhandler.c,v 1.26 2014/02/22 18:56:25 matt Exp $	*/
+/*	$NetBSD: isa_irqhandler.c,v 1.26.4.1 2014/11/10 17:59:56 snj Exp $	*/
 
 /*
  * Copyright 1997
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.26 2014/02/22 18:56:25 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_irqhandler.c,v 1.26.4.1 2014/11/10 17:59:56 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -320,8 +320,10 @@ intr_claim(int irq, int level, int (*ih_
 	ih->ih_arg = ih_arg;
 	ih->ih_flags = 0;
 
-	if (irq_claim(irq, ih, group, name) != 0) 
+	if (irq_claim(irq, ih, group, name) != 0) {
+		free(ih, M_DEVBUF);
 		return(NULL);
+	}
 
 	return(ih);
 }

Index: src/sys/arch/sparc/sparc/machdep.c
diff -u src/sys/arch/sparc/sparc/machdep.c:1.326 src/sys/arch/sparc/sparc/machdep.c:1.326.4.1
--- src/sys/arch/sparc/sparc/machdep.c:1.326	Fri Feb 28 10:16:51 2014
+++ src/sys/arch/sparc/sparc/machdep.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.326 2014/02/28 10:16:51 skrll Exp $ */
+/*	$NetBSD: machdep.c,v 1.326.4.1 2014/11/10 17:59:57 snj Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326 2014/02/28 10:16:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326.4.1 2014/11/10 17:59:57 snj Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_sunos.h"
@@ -1378,8 +1378,10 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_s
 	 */
 	error = uvm_pglistalloc(size, low, high, 0, 0,
 				mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
-	if (error)
+	if (error) {
+		free(mlist, M_DEVBUF);
 		return (error);
+	}
 
 	/*
 	 * Simply keep a pointer around to the linked list, so

Index: src/sys/arch/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.118 src/sys/arch/sparc64/dev/psycho.c:1.118.4.1
--- src/sys/arch/sparc64/dev/psycho.c:1.118	Sat Dec  7 11:17:24 2013
+++ src/sys/arch/sparc64/dev/psycho.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.118 2013/12/07 11:17:24 nakayama Exp $	*/
+/*	$NetBSD: psycho.c,v 1.118.4.1 2014/11/10 17:59:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.118 2013/12/07 11:17:24 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.118.4.1 2014/11/10 17:59:57 snj Exp $");
 
 #include "opt_ddb.h"
 
@@ -1272,8 +1272,7 @@ psycho_intr_establish(bus_space_tag_t t,
 	int ino;
 	long vec = INTVEC(ihandle);
 
-	ih = (struct intrhand *)
-		malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
+	ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
 	if (ih == NULL)
 		return (NULL);
 
@@ -1342,6 +1341,7 @@ psycho_intr_establish(bus_space_tag_t t,
 	}
 
 	printf("Cannot find interrupt vector %lx\n", vec);
+	free(ih, M_DEVBUF);
 	return (NULL);
 
 found:

Index: src/sys/arch/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.31 src/sys/arch/sparc64/dev/schizo.c:1.31.8.1
--- src/sys/arch/sparc64/dev/schizo.c:1.31	Fri Jun 21 20:09:58 2013
+++ src/sys/arch/sparc64/dev/schizo.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: schizo.c,v 1.31 2013/06/21 20:09:58 nakayama Exp $	*/
+/*	$NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $	*/
 /*	$OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31 2013/06/21 20:09:58 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.31.8.1 2014/11/10 17:59:57 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -195,6 +195,7 @@ schizo_attach(device_t parent, device_t 
 			  ma->ma_reg[0].ur_len,
 			  BUS_SPACE_MAP_LINEAR, &pbm->sp_intrh)) {
 		aprint_error(": failed to interrupt map registers\n");
+		kmem_free(pbm, sizeof(*pbm));
 		return;
 	}
 

Index: src/sys/arch/sparc64/sparc64/machdep.c
diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.278.2.1 src/sys/arch/sparc64/sparc64/machdep.c:1.278.2.2
--- src/sys/arch/sparc64/sparc64/machdep.c:1.278.2.1	Thu Oct 30 12:33:17 2014
+++ src/sys/arch/sparc64/sparc64/machdep.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.278.2.1 2014/10/30 12:33:17 martin Exp $ */
+/*	$NetBSD: machdep.c,v 1.278.2.2 2014/11/10 17:59:57 snj Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.278.2.1 2014/10/30 12:33:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.278.2.2 2014/11/10 17:59:57 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1441,8 +1441,10 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_s
 	 */
 	error = uvm_pglistalloc(size, low, high,
 	    alignment, boundary, pglist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
-	if (error)
+	if (error) {
+		free(pglist, M_DEVBUF);
 		return (error);
+	}
 
 	/*
 	 * Compute the location, size, and number of segments actually

Index: src/sys/arch/sun68k/sun68k/bus.c
diff -u src/sys/arch/sun68k/sun68k/bus.c:1.21 src/sys/arch/sun68k/sun68k/bus.c:1.21.60.1
--- src/sys/arch/sun68k/sun68k/bus.c:1.21	Wed Jun  4 12:41:41 2008
+++ src/sys/arch/sun68k/sun68k/bus.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.21 2008/06/04 12:41:41 ad Exp $	*/
+/*	$NetBSD: bus.c,v 1.21.60.1 2014/11/10 17:59:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -153,7 +153,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.21 2008/06/04 12:41:41 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.21.60.1 2014/11/10 17:59:57 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -266,8 +266,10 @@ extern	paddr_t avail_end;
 	 */
 	error = uvm_pglistalloc(size, low, high, 0, 0,
 				mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
-	if (error)
+	if (error) {
+		free(mlist, M_DEVBUF);
 		return (error);
+	}
 
 	/*
 	 * Simply keep a pointer around to the linked list, so

Index: src/sys/arch/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.57 src/sys/arch/x86/x86/ipmi.c:1.57.2.1
--- src/sys/arch/x86/x86/ipmi.c:1.57	Sun Aug 10 16:44:34 2014
+++ src/sys/arch/x86/x86/ipmi.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipmi.c,v 1.57 2014/08/10 16:44:34 tls Exp $ */
+/*	$NetBSD: ipmi.c,v 1.57.2.1 2014/11/10 17:59:57 snj Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.57 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.57.2.1 2014/11/10 17:59:57 snj Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1209,6 +1209,7 @@ get_sdr(struct ipmi_softc *sc, uint16_t 
 		    psdr + offset, NULL)) {
 			printf("ipmi: get chunk : %d,%d fails\n",
 			    offset, len);
+			free(psdr, M_DEVBUF);
 			return (-1);
 		}
 	}

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.45 src/sys/arch/xen/xen/privcmd.c:1.45.4.1
--- src/sys/arch/xen/xen/privcmd.c:1.45	Wed Nov  6 06:23:15 2013
+++ src/sys/arch/xen/xen/privcmd.c	Mon Nov 10 17:59:57 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.45 2013/11/06 06:23:15 mrg Exp $ */
+/* $NetBSD: privcmd.c,v 1.45.4.1 2014/11/10 17:59:57 snj Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.45 2013/11/06 06:23:15 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.45.4.1 2014/11/10 17:59:57 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -553,7 +553,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;
@@ -577,6 +577,9 @@ privcmd_map_obj(struct vm_map *map, vadd
 	}
 	if (newstart != start) {
 		printf("uvm_map didn't give us back our vm space\n");
+		uvm_unmap1(map, newstart, newstart + size, 0);
+		if (obj)
+			obj->uobj.pgops->pgo_detach(&obj->uobj);
 		return EINVAL;
 	}
 	return 0;

Reply via email to