FreeCalypso > hg > fc-magnetite
view src/gpf2/frame/frame_ps.def @ 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 | 864b8cc0cf63 |
children |
line wrap: on
line source
LIBRARY DESCRIPTION "GPS Frame" EXPORTS vsi_m_new vsi_m_free vsi_c_open vsi_c_close vsi_c_clear vsi_c_send vsi_c_free vsi_c_new vsi_c_await vsi_c_primitive vsi_t_start vsi_t_pstart vsi_t_stop vsi_t_status vsi_t_config vsi_s_open vsi_s_close vsi_s_get vsi_s_release vsi_o_ttrace vsi_o_itrace vsi_o_ptrace vsi_o_strace vsi_o_assert vsi_gettaskname vsi_gettaskhandle vsi_gettaskflags vsi_gettracemask vsi_settracemask vsi_t_time vsi_t_sleep vsi_d_init vsi_d_open vsi_d_close vsi_d_read vsi_d_write vsi_d_setsignal vsi_d_resetsignal vsi_d_setconfig vsi_d_getconfig vsi_ppm_new vsi_ppm_rec vsi_ppm_reuse vsi_ppm_access vsi_ppm_send vsi_ppm_free vsi_trc_free vsi_trc_new vsi_trcsuspend pf_StartAllTasks pf_CreateAllEntities pf_Init os_CreateTask os_DestroyTask os_StartTask os_StopTask os_GetTaskName os_GetTaskHandle os_SuspendTask os_TaskInformation os_CreateQueue os_DestroyQueue os_OpenQueue os_CloseQueue os_SendToQueue os_ReceiveFromQueue os_QueueInformation os_CreatePartitionPool os_AllocatePartition os_DeallocatePartition os_CreateMemoryPool os_AllocateMemory os_DeallocateMemory os_PartitionInformation os_MemoryInformation os_CreateTimer os_DestroyTimer os_StartTimer os_StopTimer os_QueryTimer os_TimerInformation os_CreateSemaphore os_DestroySemaphore os_OpenSemaphore os_CloseSemaphore os_ObtainSemaphore os_ReleaseSemaphore os_SemaphoreInformation os_GetTime os_ObjectInformation CondatMemPoolHandle PrimGroupHandle TestGroupHandle