FreeCalypso > hg > fc-magnetite
view src/cs/riviera/tests/rv/rv_test_exec_def.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
/** * @file rv_test_exec_def.h * * LCD and Keypad definitions. * * All the definitions below are used to control LCD and keypad * when being in EXEC mode (tests to execute are chosen at execution * time with the keypad and the LCD). * * @author Cedric Baudelet * @author Vincent Oberle */ /* * History: * * Date Author Modification * ------------------------------------------------------------------- * 03/13/02 Vincent Oberle Put from rv_test.h in its own file. * * (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved */ #ifndef _RV_TEST_EXEC_DEF_H_ #define _RV_TEST_EXEC_DEF_H_ #define TEST_TYPE_STATE (1) #define TEST_LEVEL_STATE (2) #define TEST_NUMBER_STATE (3) #define NB_OF_TEST_TO_PASS_STATE (4) #define TEST_AUDIO_STATE (5) #define TEST_AUDIO_SERVICES_STATE (6) #define LCD_LEN (6) /* RV TEST TEST_TYPE PARAMETER */ #define TEST_TYPE_LCD_LEN (6) static char TEST_TYPE_LCD [TEST_TYPE_LCD_LEN][15] = {" TEST TYPE ", " 1 - REGR ", " 2 - CERTIF ", " 3 - DEMO ", " 4 - MISC ", " 5 - UPF "}; /* RV TEST TEST_AUDIO PARAMETER */ #define TEST_AUDIO_LCD_LEN (3) static char TEST_AUDIO_LCD [TEST_TYPE_LCD_LEN][15] = {" TEST AUDIO ", " 1-LIST ", " 2-ONESHOT "}; /* RV TEST TEST_AUDIO_SERVICES PARAMETER */ #define TEST_AUDIO_SERVICES_LCD_LEN (5) static char TEST_AUDIO_SERVICES_LCD [TEST_TYPE_LCD_LEN][15] = {" AUDIO SERVICE", " 1 - KEYBEEP", " 2 - TONES ", " 3 - MELODY "}; /* RV TEST TEST_MPM_SERVICES PARAMETER */ #define TEST_MPM_LCD_LEN (/*8*/6) static char TEST_MPM_LCD [TEST_MPM_LCD_LEN][15] = { " TEST MPM ", " ", "1- TEST LOOP ", "2- WAIT STATES", "3- PREDEFINED ", " COMMANDS "}; /*, "4- OTHER ", " COMMAND "};*/ #endif /* _RV_TEST_EXEC_DEF_H_ */