summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortracey <tracey@cvs.openbsd.org>2020-03-19 16:17:52 +0000
committertracey <tracey@cvs.openbsd.org>2020-03-19 16:17:52 +0000
commit01d4c6a51dc2b47b4e15976bfde440712b5edb4c (patch)
treed1602120c126ea986cb967310494f77b7b7dde7e
parent7fa7600b44c4726b3519cad2dfee4a6621029dc8 (diff)
Plug memory leak of psensor if read_sensor does not return zero.
CID 1491654 ok mpi@ kn@ florian@
-rw-r--r--sys/dev/ipmi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c
index 3419b17d51a..aa575e62785 100644
--- a/sys/dev/ipmi.c
+++ b/sys/dev/ipmi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipmi.c,v 1.110 2020/03/09 04:51:24 yasuoka Exp $ */
+/* $OpenBSD: ipmi.c,v 1.111 2020/03/19 16:17:51 tracey Exp $ */
/*
* Copyright (c) 2015 Masao Uebayashi
@@ -1411,7 +1411,8 @@ add_child_sensors(struct ipmi_softc *sc, u_int8_t *psdr, int count,
dbg_printf(5, " reading: %lld [%s]\n",
psensor->i_sensor.value,
psensor->i_sensor.desc);
- }
+ } else
+ free(psensor, M_DEVBUF, sizeof(*psensor));
}
return (1);