FreeCalypso > hg > fc-magnetite
annotate cdg-hybrid/cdginc/p_tb.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 |
rev | line source |
---|---|
212
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +--------------------------------------------------------------------------+ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | PROJECT : PROTOCOL STACK | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | FILE : p_tb.h | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | SOURCE : "sap\tb.pdf" | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | LastModified : "2001-07-17" | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | IdAndVersion : "8441.112.01.002" | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | SrcFileTime : "Thu Nov 29 09:54:48 2007" | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Generated by CCDGEN_2.5.5A on Fri Oct 14 21:41:52 2016 | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 +--------------------------------------------------------------------------+ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 /* PRAGMAS |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 * PREFIX : NONE |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 * COMPATIBILITY_DEFINES : NO (require PREFIX) |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 * ALWAYS_ENUM_IN_VAL_FILE: NO |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 * ENABLE_GROUP: NO |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 * CAPITALIZE_TYPENAME: NO |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #ifndef P_TB_H |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #define P_TB_H |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #define CDG_ENTER__P_TB_H |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #define CDG_ENTER__FILENAME _P_TB_H |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #define CDG_ENTER__P_TB_H__FILE_TYPE CDGINC |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #define CDG_ENTER__P_TB_H__LAST_MODIFIED _2001_07_17 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #define CDG_ENTER__P_TB_H__ID_AND_VERSION _8441_112_01_002 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #define CDG_ENTER__P_TB_H__SRC_FILE_TIME _Thu_Nov_29_09_54_48_2007 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "CDG_ENTER.h" |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #undef CDG_ENTER__P_TB_H |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #undef CDG_ENTER__FILENAME |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #include "p_tb.val" |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 #ifndef __T_tb_meas_result__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 #define __T_tb_meas_result__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 /* |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * CCDGEN:WriteStruct_Count==3099 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 typedef struct |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 { |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 U16 arfcn; /*< 0: 2> channel number */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 U16 rxlev; /*< 2: 2> measurement value */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 U8 num_meas; /*< 4: 1> number */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 U8 _align0; /*< 5: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 U8 _align1; /*< 6: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 U8 _align2; /*< 7: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 } T_tb_meas_result; |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #endif |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 /* |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * End of substructure section, begin of primitive definition section |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 #ifndef __T_TB_MEAS_IND__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 #define __T_TB_MEAS_IND__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 /* |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 * CCDGEN:WriteStruct_Count==3100 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 typedef struct |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 { |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 T_tb_meas_result tb_meas_result[TB_BA_LIST_SIZE]; /*< 0:264> */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 } T_TB_MEAS_IND; |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 #endif |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 #ifndef __T_TB_RXLEV_SC_REQ__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 #define __T_TB_RXLEV_SC_REQ__ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 /* |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 * |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 * CCDGEN:WriteStruct_Count==3101 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 typedef struct |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 { |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 U8 sc_rxlev; /*< 0: 1> RXLEV value of the serving cell. */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 U8 _align0; /*< 1: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 U8 _align1; /*< 2: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 U8 _align2; /*< 3: 1> alignment */ |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 } T_TB_RXLEV_SC_REQ; |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 #endif |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 #include "CDG_LEAVE.h" |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 |
e7a67accfad9
cdg-hybrid cdginc headers created
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 #endif |