MQX 3.5/3.6 ADC Driver memory leak

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX 3.5/3.6 ADC Driver memory leak

813 Views
MarkA
Contributor I

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

0 Kudos
Reply
1 Reply

331 Views
DavidS
NXP Employee
NXP Employee

Hi MarkA,

My apologizes for not replying sooner.

Just wanted to say thank you for pointing this issue out to the forum.

I had sent it to our FSLMQX development team to fix in next release but neglected to let you know that.

Best Regards,

David

0 Kudos
Reply