FreeCalypso > hg > fc-magnetite
view src/cs/layer1/gtt_include/l1gtt_signa.h @ 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 | 945cf7f506b2 |
| children |
line wrap: on
line source
/************* Revision Controle System Header ************* * GSM Layer 1 software * L1GTT_SIGNA.H * * Filename l1gtt_signa.h * Copyright 2003 (C) Texas Instruments * ************* Revision Controle System Header *************/ #if (L1_GTT == 1) #define P_GTT ( 0x19 ) // Messages Upper layer <-> L1A #define MMI_GTT_START_REQ ( ( P_GTT << 8 ) | 1 ) #define MMI_GTT_START_CON ( ( P_GTT << 8 ) | 2 ) #define MMI_GTT_STOP_REQ ( ( P_GTT << 8 ) | 3 ) #define MMI_GTT_STOP_CON ( ( P_GTT << 8 ) | 4 ) // Messages L1S <-> L1A #define L1_GTT_START_CON ( ( P_GTT << 8 ) | 5 ) #define L1_GTT_STOP_CON ( ( P_GTT << 8 ) | 6 ) // Test messages #define TST_CLOSE_GTT_LOOP_REQ ( ( P_GTT << 8 ) | 7 ) #define TST_CLOSE_GTT_LOOP_CON ( ( P_GTT << 8 ) | 8 ) #define TST_OPEN_GTT_LOOP_REQ ( ( P_GTT << 8 ) | 9 ) #define TST_OPEN_GTT_LOOP_CON ( ( P_GTT << 8 ) | 10 ) #define TST_START_GTT_TEST_REQ ( ( P_GTT << 8 ) | 11 ) #define TST_START_GTT_TEST_CON ( ( P_GTT << 8 ) | 12 ) #define TST_STOP_GTT_TEST_REQ ( ( P_GTT << 8 ) | 13 ) #define TST_STOP_GTT_TEST_CON ( ( P_GTT << 8 ) | 14 ) #endif // L1_GTT == 1
