summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-04-27 11:41:31 +0000
committerpatrick <patrick@openbsd.org>2020-04-27 11:41:31 +0000
commitf9087cb3d87bbe9bbb261d3aa2df8136308affb5 (patch)
tree3fc8ee5a64b607a20296bb4ae5bbe1d0dfc73f10
parentfix SDHC_DEBUG build, remove procname printf's (diff)
downloadwireguard-openbsd-f9087cb3d87bbe9bbb261d3aa2df8136308affb5.tar.xz
wireguard-openbsd-f9087cb3d87bbe9bbb261d3aa2df8136308affb5.zip
Free the "ranges" array in the error handling paths.
ok kettenis@
-rw-r--r--sys/dev/fdt/dwpcie.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/fdt/dwpcie.c b/sys/dev/fdt/dwpcie.c
index f10a654dc7b..195e11e5c81 100644
--- a/sys/dev/fdt/dwpcie.c
+++ b/sys/dev/fdt/dwpcie.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwpcie.c,v 1.18 2020/04/26 15:17:21 patrick Exp $ */
+/* $OpenBSD: dwpcie.c,v 1.19 2020/04/27 11:41:31 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
@@ -325,6 +325,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr,
faa->fa_reg[0].size, 0, &sc->sc_ioh)) {
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map ctrl registers\n");
return;
}
@@ -337,6 +339,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
if (bus_space_map(sc->sc_iot, sc->sc_cfg0_base,
sc->sc_cfg1_size, 0, &sc->sc_cfg0_ioh)) {
bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size);
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map config registers\n");
return;
}
@@ -345,6 +349,8 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux)
sc->sc_cfg1_size, 0, &sc->sc_cfg1_ioh)) {
bus_space_unmap(sc->sc_iot, sc->sc_cfg0_ioh, sc->sc_cfg0_size);
bus_space_unmap(sc->sc_iot, sc->sc_ioh, faa->fa_reg[0].size);
+ free(sc->sc_ranges, M_TEMP, sc->sc_nranges *
+ sizeof(struct dwpcie_range));
printf(": can't map config registers\n");
return;
}