Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev sun4v: Fix potential memory leaks - spo...
details: https://anonhg.NetBSD.org/src/rev/152ece12c267
branches: trunk
changeset: 351559:152ece12c267
user: palle <palle%NetBSD.org@localhost>
date: Fri Feb 17 20:53:17 2017 +0000
description:
sun4v: Fix potential memory leaks - spotted by maxv@
diffstat:
sys/arch/sparc64/dev/vbus.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diffs (56 lines):
diff -r f49d26f9c410 -r 152ece12c267 sys/arch/sparc64/dev/vbus.c
--- a/sys/arch/sparc64/dev/vbus.c Fri Feb 17 19:43:40 2017 +0000
+++ b/sys/arch/sparc64/dev/vbus.c Fri Feb 17 20:53:17 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vbus.c,v 1.2 2016/06/21 20:36:02 palle Exp $ */
+/* $NetBSD: vbus.c,v 1.3 2017/02/17 20:53:17 palle Exp $ */
/* $OpenBSD: vbus.c,v 1.8 2015/09/27 11:29:20 kettenis Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
@@ -159,15 +159,15 @@
if (imap_mask == NULL)
return (-1);
if (OF_getprop(parent, "interrupt-map-mask", imap_mask, len) != len)
- return (-1);
+ goto out;
if (prom_getprop(parent, "interrupt-map", sizeof(int), &nimap, (void **)&imap))
- panic("vbus: can't get interrupt-map");
+ panic("vbus: can't get interrupt-map");
if (prom_getprop(node, "reg", sizeof(*reg), &nreg, (void **)®))
- panic("vbus: can't get reg");
+ panic("vbus: can't get reg");
if (nreg < address_cells)
- return (-1);
+ goto out;
while (nimap >= address_cells + interrupt_cells + 2) {
if (vbus_cmp_cells(imap, reg, imap_mask, address_cells) &&
@@ -180,21 +180,24 @@
reg = NULL;
if (prom_getprop(node, "reg", sizeof(*reg), &nreg, (void **)®))
- panic("vbus: can't get reg");
+ panic("vbus: can't get reg");
devhandle = reg[0] & 0x0fffffff;
err = hv_intr_devino_to_sysino(devhandle, devino, sysino);
if (err != H_EOK)
- return (-1);
+ goto out;
KASSERT(*sysino == INTVEC(*sysino));
+ free(imap_mask, M_DEVBUF);
return (0);
}
imap += address_cells + interrupt_cells + 2;
nimap -= address_cells + interrupt_cells + 2;
}
+out:
+ free(imap_mask, M_DEVBUF);
return (-1);
}
Home |
Main Index |
Thread Index |
Old Index