Re: possible memory leak in ipmi get_sdr

2022-04-07 Thread Stuart Henderson
On 2022/04/07 13:31, Moritz Buhl wrote: > Any insights? > On Mon, Jan 10, 2022 at 03:18:47PM +0100, Moritz Buhl wrote: > > Hi tech@, > > > > The return value of add_child_sensors is returned in add_sdr_sensor, > > which is called by get_sdr. get_sdr mallocs psdr and only frees it > > if add_sdr_

Re: possible memory leak in ipmi get_sdr

2022-04-07 Thread Moritz Buhl
Any insights? On Mon, Jan 10, 2022 at 03:18:47PM +0100, Moritz Buhl wrote: > Hi tech@, > > The return value of add_child_sensors is returned in add_sdr_sensor, > which is called by get_sdr. get_sdr mallocs psdr and only frees it > if add_sdr_sensor returns 0. The assumption is that psdr is atta

Re: possible memory leak in ipmi get_sdr

2022-01-14 Thread Benjamin Baier
On Fri, 14 Jan 2022 09:25:53 +0100 Moritz Buhl wrote: > I thought I'd walk through my understanding of the code > to make it easier to review. > > from sys/dev/ipmi.c: > > 1019 int > 1020 get_sdr(struct ipmi_softc *sc, u_int16_t recid, u_int16_t *nxtrec) > 1021 { > ... > 1046 psdr = mal

Re: possible memory leak in ipmi get_sdr

2022-01-14 Thread Moritz Buhl
I thought I'd walk through my understanding of the code to make it easier to review. from sys/dev/ipmi.c: 1019 int 1020 get_sdr(struct ipmi_softc *sc, u_int16_t recid, u_int16_t *nxtrec) 1021 { ... 1046 psdr = malloc(sdrlen, M_DEVBUF, M_NOWAIT); 1047 if (psdr == NULL) 1048

possible memory leak in ipmi get_sdr

2022-01-10 Thread Moritz Buhl
Hi tech@, The return value of add_child_sensors is returned in add_sdr_sensor, which is called by get_sdr. get_sdr mallocs psdr and only frees it if add_sdr_sensor returns 0. The assumption is that psdr is attached to a list in add_child_sensors otherwise. This is not the case if the malloc for