FreeCalypso > hg > fc-magnetite
view src/ui3/mfw/mfw_nmi.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 | e8ddbb0837ed |
children |
line wrap: on
line source
/* +--------------------------------------------------------------------+ | PROJECT: GSM-MFW (?) $Workfile:: mfw_nmi.h $| | $Author:: Vo $Revision:: 1 $| | CREATED: 07.10.98 $Modtime:: 21.10.99 12:18 $| | STATE : code | +--------------------------------------------------------------------+ PURPOSE : Internal definitions for network management History May 31, 2007 DR: OMAPS00133201 x0pleela Description: MS keeps searching networks and doesn't list available PLMNs after performing manual selection Solution : Modified the prototype of function nm_error_cops() */ #ifndef DEF_MFW_NMI_HEADER #define DEF_MFW_NMI_HEADER #define MAX_PREF_PLNM 8 #define MAX_PIN_COUNT 3 /* permit maximal entering for user */ #define MAX_PUK_COUNT 5 #define FIRST_SIM_INVAILD 1 #define SERVICE_OK 1 #define SERVICE_FAILURE 0 #define CMD_NOT_PRESENT 0 /* * Network Control Block */ typedef struct { T_MFW_EVENT emask; /* events of interest */ T_MFW_EVENT event; /* current event */ T_MFW_CB handler; T_MFW_NM_PARA para; } T_MFW_NM; EXTERN T_MFW_HND nm_install (T_MFW_HDR *w, T_MFW_HDR *h, T_MFW_NM *nm); EXTERN T_MFW_RES nm_remove (T_MFW_HDR *h); EXTERN void nm_activate (UBYTE result); #ifdef FF_2TO1_PS EXTERN void nm_mmi_parameters (T_SIM_imsi_field *imsi_field, T_SIM_pref_plmn *pref_plmn); #else EXTERN void nm_mmi_parameters (T_imsi_field *imsi_field); #endif EXTERN void nm_spn_cnf (USHORT error, T_EF_SPN *efspn); EXTERN void nm_ok_cops (void); //x0pleela 30 May, 2007 DR: OMAPS00133201 //Passing T_ACI_CME_ERR as parameter EXTERN void nm_error_cops ( T_ACI_CME_ERR err ); EXTERN void nm_req_imsi (UBYTE *imsi_id); EXTERN T_MFW nm_reg_flag_req (void); EXTERN void nm_ok_deregistration (void); EXTERN void nm_ok_pref_plmn (void); EXTERN void nm_error_pref_plmn (void); EXTERN void nm_sat_file_update (USHORT dataId); EXTERN void nm_ok_band (void); /*SPR919 - SH - added */ #endif