FreeCalypso > hg > fc-magnetite
annotate cdg3/cdginc-conservative/p_mdl.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 | c15047b3d00d |
children |
rev | line source |
---|---|
16
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 +--------------------------------------------------------------------------+ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 | PROJECT : PROTOCOL STACK | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 | FILE : p_mdl.h | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 | SOURCE : "sap\mdl.pdf" | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 | LastModified : "2002-04-19" | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 | IdAndVersion : "6147.111.97.101" | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 | SrcFileTime : "Thu Nov 29 09:45:46 2007" | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 | Generated by CCDGEN_2.5.5A on Thu Sep 25 09:52:55 2014 | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 | !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 +--------------------------------------------------------------------------+ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 /* PRAGMAS |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 * PREFIX : NONE |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 * COMPATIBILITY_DEFINES : NO (require PREFIX) |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 * ALWAYS_ENUM_IN_VAL_FILE: NO |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 * ENABLE_GROUP: NO |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 * CAPITALIZE_TYPENAME: NO |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #ifndef P_MDL_H |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #define P_MDL_H |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #define CDG_ENTER__P_MDL_H |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #define CDG_ENTER__FILENAME _P_MDL_H |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #define CDG_ENTER__P_MDL_H__FILE_TYPE CDGINC |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #define CDG_ENTER__P_MDL_H__LAST_MODIFIED _2002_04_19 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #define CDG_ENTER__P_MDL_H__ID_AND_VERSION _6147_111_97_101 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 #define CDG_ENTER__P_MDL_H__SRC_FILE_TIME _Thu_Nov_29_09_45_46_2007 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 #include "CDG_ENTER.h" |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 #undef CDG_ENTER__P_MDL_H |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 #undef CDG_ENTER__FILENAME |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 #include "p_mdl.val" |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 /* |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * End of substructure section, begin of primitive definition section |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 #ifndef __T_MDL_ERROR_IND__ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 #define __T_MDL_ERROR_IND__ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 /* |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * CCDGEN:WriteStruct_Count==1786 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 typedef struct |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 { |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 U8 ch_type; /*< 0: 1> channel type */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 U8 sapi; /*< 1: 1> service access point identifier */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 U8 cs; /*< 2: 1> error cause */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 U8 _align0; /*< 3: 1> alignment */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 } T_MDL_ERROR_IND; |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 #endif |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 #ifndef __T_MDL_RELEASE_REQ__ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #define __T_MDL_RELEASE_REQ__ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 /* |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * CCDGEN:WriteStruct_Count==1787 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 typedef struct |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 { |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 U8 ch_type; /*< 0: 1> channel type */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 U8 sapi; /*< 1: 1> service access point identifier */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 U8 _align0; /*< 2: 1> alignment */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 U8 _align1; /*< 3: 1> alignment */ |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } T_MDL_RELEASE_REQ; |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 #endif |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 #include "CDG_LEAVE.h" |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 |
c15047b3d00d
cdg3: import from freecalypso-citrine/cdg
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 #endif |