view cdg-hybrid/sap-inline/8010_136_simdrv_sap_inline.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 e7a67accfad9
children
line wrap: on
line source

/***
;********************************************************************************
;*** File           : 8010_136_simdrv_sap_inline.h
;*** Creation       : Wed Mar 11 09:57:50 CST 2009
;*** 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  : 8010_136_simdrv_sap
;*** Document No.   : 8010.136.03.009
;*** Document Date  : 2004-06-10
;*** Document Status: BEING_PROCESSED
;*** Document Author: FDU
;********************************************************************************
;*** !!! THIS INCLUDE FILE WAS GENERATED AUTOMATICALLY, DO NOT MODIFY !!!
;********************************************************************************
 ***/
#ifndef _8010_136_SIMDRV_SAP_INLINE_H_
#define _8010_136_SIMDRV_SAP_INLINE_H_



extern  void simdrv_poweroff ( U8 reader_id );

extern  U8 simdrv_reset ( U8 reader_id, U8 voltage_select );

extern  U16 simdrv_xch_apdu ( U8 reader_id, T_SIMDRV_cmd_header cmd_header, T_SIMDRV_data_info data_info, T_SIMDRV_result_info *result_info );

extern  void simdrv_register ( void ( *simdrv_insert )( T_SIMDRV_atr_string_info *atr_string_info, U8 config_requested, T_SIMDRV_config_characteristics *config_characteristics ), void ( *simdrv_remove )( void ) );

extern  void simdrv_insert ( T_SIMDRV_atr_string_info *atr_string_info, U8 config_requested, T_SIMDRV_config_characteristics *config_characteristics );

extern  void simdrv_remove ( void );




#endif /* !_8010_136_SIMDRV_SAP_INLINE_H_ */