FreeCalypso > hg > fc-magnetite
annotate cdg211/cdginc/p_aci.val @ 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 | 56abf6cf8a0b |
children |
rev | line source |
---|---|
4
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +--------------------------------------------------------------------------+ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | PROJECT : PROTOCOL STACK | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | FILE : p_aci.val | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | SOURCE : "__out__\g23m_dfile\prim\aci.pdf" | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | LastModified : "2004-06-01" | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | IdAndVersion : "8411.105.00.205" | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | SrcFileTime : "Mon Jun 7 15:08:48 2004" | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Generated by CCDGEN_2.5.5 on Fri Jun 08 13:59:14 2007 | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 +--------------------------------------------------------------------------+ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 /* PRAGMAS |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 * PREFIX : NONE |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 * COMPATIBILITY_DEFINES : NO (require PREFIX) |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 * ALWAYS_ENUM_IN_VAL_FILE: NO |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 * ENABLE_GROUP: NO |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 * CAPITALIZE_TYPENAME: NO |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #ifndef P_ACI_VAL |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #define P_ACI_VAL |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #define CDG_ENTER__P_ACI_VAL |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #define CDG_ENTER__FILENAME _P_ACI_VAL |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #define CDG_ENTER__P_ACI_VAL__FILE_TYPE CDGINC |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #define CDG_ENTER__P_ACI_VAL__LAST_MODIFIED _2004_06_01 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #define CDG_ENTER__P_ACI_VAL__ID_AND_VERSION _8411_105_00_205 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #define CDG_ENTER__P_ACI_VAL__SRC_FILE_TIME _Mon_Jun_7_15_08_48_2004 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "CDG_ENTER.h" |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #undef CDG_ENTER__P_ACI_VAL |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #undef CDG_ENTER__FILENAME |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 * Value constants for VAL_cmd_src |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #define CMD_SRC_INT (0x0) /* Command from internal application */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 #define CMD_SRC_EXT (0x1) /* Command from external application */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 #define CMD_SRC_UNKNOWN (0xff) /* Reserved */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * Value constants for VAL_urt_stat |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 #define URT_RDY_TO_SEND (0x0) /* URT is ready to accept new data */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 #define URT_DATA_AVAIL (0x1) /* URT has data available */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 #define URT_STAT_UNKNOWN (0xff) /* Reserved */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 * Value constants for VAL_cause |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #define ABT_ABORT_DATA (0x0) /* Abort data mode */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 #define ABT_ABORT_CMD (0x1) /* Abort current command */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * Value constants for VAL_ackflg |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #define ACI_NAK (0x0) /* Not Acknowledge */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #define ACI_ACK (0x1) /* Acknowledge */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 /* |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * user defined constants |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 */ |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 #define MAX_CMD_LEN (0x17c) |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 #define MAX_TRC_LEN (0x50) |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 #define MAX_DATA_LEN (0xc8) |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 #include "CDG_LEAVE.h" |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
56abf6cf8a0b
cdg211: cdginc/mdf/pdf files from TCS211-20070608
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 #endif |