summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2018-08-30 12:14:31 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2018-08-30 12:14:31 +0000
commit031fb07bcdb86fb5a101435b2e5c246d5a11b640 (patch)
tree7394c37071f30aca0c78dc6175379e213c845a2a /sys
parent88e628bbfd083421f636ce8231fc7cad97a96039 (diff)
fix memory leak in an error path
ok patrick@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/imxanatop.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/fdt/imxanatop.c b/sys/dev/fdt/imxanatop.c
index a90b8014ca3..30475b935f2 100644
--- a/sys/dev/fdt/imxanatop.c
+++ b/sys/dev/fdt/imxanatop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxanatop.c,v 1.4 2018/06/28 10:07:35 kettenis Exp $ */
+/* $OpenBSD: imxanatop.c,v 1.5 2018/08/30 12:14:30 jsg Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis <kettenis@openbsd.org>
*
@@ -196,8 +196,10 @@ imxanatop_attach_regulator(struct imxanatop_softc *sc, int node)
ir->ir_max_voltage = OF_getpropint(node, "anatop-max-voltage", -1);
if (ir->ir_reg_offset == -1 || ir->ir_vol_bit_shift == -1 ||
ir->ir_vol_bit_width == -1 || ir->ir_min_bit_val == -1 ||
- ir->ir_min_voltage == -1 || ir->ir_max_voltage == -1)
+ ir->ir_min_voltage == -1 || ir->ir_max_voltage == -1) {
+ free(ir, M_DEVBUF, sizeof(*ir));
return;
+ }
ir->ir_delay_reg_offset =
OF_getpropint(node, "anatop-delay-reg-offset", 0);