FreeCalypso > hg > fc-magnetite
view cdg211/prim/cci.pdf @ 516:1ed9de6c90bd
src/g23m-gsm/sms/sms_for.c: bogus malloc removed
The new error handling code that was not present in TCS211 blob version
contains a malloc call that is bogus for 3 reasons:
1) The memory allocation in question is not needed in the first place;
2) libc malloc is used instead of one of the firmware's proper ways;
3) The memory allocation is made inside a function and then never freed,
i.e., a memory leak.
This bug was caught in gcc-built FreeCalypso fw projects (Citrine
and Selenite) because our gcc environment does not allow any use of
libc malloc (any reference to malloc produces a link failure),
but this code from TCS3.2 is wrong even for Magnetite: if this code
path is executed repeatedly over a long time, the many small allocations
made by this malloc call without a subsequent free will eventually
exhaust the malloc heap provided by the TMS470 environment, malloc will
start returning NULL, and the bogus code will treat it as an error.
Because the memory allocation in question is not needed at all,
the fix entails simply removing it.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 22 Jul 2018 06:04:49 +0000 |
parents | 56abf6cf8a0b |
children |
line wrap: on
line source
;******************************************************************************** ;*** File : cci.pdf ;*** Creation : Fri Jun 08 13:57:04 CST 2007 ;*** XSLT Processor : Apache Software Foundation / http://xml.apache.org/xalan-j / supports XSLT-Ver: 1 ;*** Copyright : (c) Texas Instruments AG, Berlin Germany 2002 ;******************************************************************************** ;*** Document Type : Service Access Point Specification ;*** Document Name : cci ;*** Document No. : 8441.118.00.017 ;*** Document Date : 2003-01-13 ;*** Document Status: BEING_PROCESSED ;*** Document Author: UT ;******************************************************************************** PRAGMA SRC_FILE_TIME "Wed Mar 2 15:05:54 2005" PRAGMA LAST_MODIFIED "2003-01-13" PRAGMA ID_AND_VERSION "8441.118.00.017" VALTAB VAL_algo_type VAL 0 CCI_ALGO_V42 "V42bis algorithm" VALTAB VAL_comp_inst VAL 0 CCI_COMP_INST_V42_0 "first instance for V42bis" VAR algo_type "algorithm type" B VAL @p_cci - VAL_algo_type@ VAR comp_inst "compressor instance" B VAL @p_cci - VAL_comp_inst@ ; CCI_INIT_REQ 0x3604 PRIM CCI_INIT_REQ 0x3604 { algo_type ; algorithm type comp_inst ; compressor instance }