AnsweredAssumed Answered

MQX 3.5/3.6 ADC Driver memory leak

Question asked by Mark Armbrust on Jul 9, 2010
Latest reply on Jul 29, 2010 by David E Seymour

There is a memory leak in the MQX 3.5/3.6 ADC Driver.  Every time one opens and closes an ADC channel 36 bytes of memory are lost.

 

The problem is that the adc_channel_bundle allocated in _adc_open() is not freed in _adc_close().

 

The fix is to free adc_channel_bundle at the end of _adc_close().

 

RCS file: r:/Windsor/RCS/mqx_3_6/mqx/source/io/adc/adc.c,v

retrieving revision 1.1

retrieving revision 1.2

diff -c -r1.1 -r1.2

*** adc.c       2010/06/04 15:25:14     1.1

--- adc.c       2010/07/09 22:21:26     1.2

***************

*** 346,351 ****

--- 346,353 ----

        _mem_free(adc_channel_bundle->adc_ch->g.buffer_start);

        _mem_free(adc_channel_bundle->adc_ch);

        _mem_free(adc_channel_bundle->adt_ch);

+       _mem_free(adc_channel_bundle);         /* MAA 7 July 2010 */

+

        adc_ch[i] = NULL;

        adt_ch[i] = NULL;

     }

 

--Mark

Outcomes