FreeCalypso > hg > fc-magnetite
annotate components/gdi @ 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 | 4d7c2ccb5814 |
children |
rev | line source |
---|---|
26 | 1 # Building gdi.lib |
2 | |
3 CFLAGS="-me -mt -o -pw2 -x -mw" | |
4 | |
5 # Defines | |
6 | |
7 CPPFLAGS=-DCCDTABLES_EXTERN | |
8 CPPFLAGS="$CPPFLAGS -DOPTION_MULTITHREAD" | |
9 CPPFLAGS="$CPPFLAGS -DNEW_FRAME" | |
10 CPPFLAGS="$CPPFLAGS -DNEW_ENTITY" | |
11 CPPFLAGS="$CPPFLAGS -D_TARGET_" | |
12 CPPFLAGS="$CPPFLAGS -DSHARED_VSI" | |
13 CPPFLAGS="$CPPFLAGS -DALR" | |
14 CPPFLAGS="$CPPFLAGS -DFF_HOMEZONE" | |
15 CPPFLAGS="$CPPFLAGS -DFF_MMI_SAT_ICON" | |
16 CPPFLAGS="$CPPFLAGS -DFF_MMI_SMS_DYNAMIC" | |
17 CPPFLAGS="$CPPFLAGS -DFF_CPHS" | |
18 CPPFLAGS="$CPPFLAGS -D_TMS470" | |
19 CPPFLAGS="$CPPFLAGS -DUART" | |
20 CPPFLAGS="$CPPFLAGS -DFF_ATI" | |
21 CPPFLAGS="$CPPFLAGS -DNWARN" | |
22 CPPFLAGS="$CPPFLAGS -DFF_EM_MODE" | |
23 CPPFLAGS="$CPPFLAGS -DMMI=$MMI" | |
24 | |
25 if [ "$MMI" = 0 ] | |
26 then | |
27 CPPFLAGS="$CPPFLAGS -DACI" | |
28 elif [ "$MMI" = 2 ] | |
29 then | |
30 CPPFLAGS="$CPPFLAGS -DMFW" | |
31 fi | |
32 | |
33 CPPFLAGS="$CPPFLAGS -DMMI_HOMEZONE_ENABLED" | |
34 CPPFLAGS="$CPPFLAGS -DFF_MMI_SAT_ICON" | |
35 CPPFLAGS="$CPPFLAGS -DFF_MMI_SMS_DYNAMIC" | |
36 | |
37 if [ "$GPRS" = 1 ] | |
38 then | |
39 CPPFLAGS="$CPPFLAGS -DMMI_GPRS_ENABLED" | |
40 fi | |
41 | |
42 CPPFLAGS="$CPPFLAGS -DMMI_EM_ENABLED" | |
43 CPPFLAGS="$CPPFLAGS -DNO_ASCIIZ" | |
113
bfcfbffd2736
components/gdi: preparations for integrating tcs211-c139 work
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
44 |
452
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
45 case "$UI_CONFIG" in |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
46 bigcolor) |
451
fd1d9063ad40
config mechanism: added ability to build D-Sample B&W UI configuration
Mychaela Falconia <falcon@freecalypso.org>
parents:
392
diff
changeset
|
47 CPPFLAGS="$CPPFLAGS -DCOLOURDISPLAY" |
452
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
48 CPPFLAGS="$CPPFLAGS -DLSCREEN" |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
49 ;; |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
50 bigbw) |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
51 CPPFLAGS="$CPPFLAGS -DLSCREEN" |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
52 ;; |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
53 84x48) |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
54 ;; |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
55 *) |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
56 echo "Error: UI_CONFIG=$UI_CONFIG setting not understood" 1>&2 |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
57 exit 1 |
4d7c2ccb5814
config mechanism: high-level UI config made separate from target display drivers
Mychaela Falconia <falcon@freecalypso.org>
parents:
451
diff
changeset
|
58 esac |
113
bfcfbffd2736
components/gdi: preparations for integrating tcs211-c139 work
Mychaela Falconia <falcon@freecalypso.org>
parents:
26
diff
changeset
|
59 |
26 | 60 CPPFLAGS="$CPPFLAGS -DINT_PHONEBOOK" |
61 CPPFLAGS="$CPPFLAGS -DNEW_EDITOR" | |
62 CPPFLAGS="$CPPFLAGS -DTRGT_G23" | |
63 CPPFLAGS="$CPPFLAGS -DAUS_CONDAT_TYPE_PORTING" | |
64 CPPFLAGS="$CPPFLAGS -DPHONEBOOK_EXTENSION" | |
65 | |
66 if [ "$GPRS" = 1 ] | |
67 then | |
68 CPPFLAGS="$CPPFLAGS -DGPRS" | |
69 fi | |
70 | |
392
30203d5aeb74
components/*: -DCHIPSET=$CHIPSET instead of fixed -DCHIPSET=10
Mychaela Falconia <falcon@freecalypso.org>
parents:
378
diff
changeset
|
71 CPPFLAGS="$CPPFLAGS -DCHIPSET=$CHIPSET" |
26 | 72 CPPFLAGS="$CPPFLAGS -DBOARD=41" |
73 CPPFLAGS="$CPPFLAGS -DCUST=0" | |
74 CPPFLAGS="$CPPFLAGS -DTESTMODE=1" | |
75 | |
76 # Includes | |
77 | |
78 CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/inc" | |
79 CPPFLAGS="$CPPFLAGS -I$SRC/$GPF/inc" | |
80 CPPFLAGS="$CPPFLAGS -I$SRC/$CONDAT/com/include" | |
81 CPPFLAGS="$CPPFLAGS -I../../$CDGINC" | |
82 CPPFLAGS="$CPPFLAGS -I$SRC/$GPF/inc/nuc" | |
83 CPPFLAGS="$CPPFLAGS -I$SRC/condat2/com/src/driver" | |
84 CPPFLAGS="$CPPFLAGS -I../../$CDGPRIM" | |
85 CPPFLAGS="$CPPFLAGS -I.." | |
86 CPPFLAGS="$CPPFLAGS -I../config" | |
87 CPPFLAGS="$CPPFLAGS -I$SRC/cs/riviera" | |
88 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_app" | |
89 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core" | |
90 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/abb" | |
91 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/armio" | |
92 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/clkm" | |
93 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/conf" | |
94 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dma" | |
95 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/dsp_dwnld" | |
96 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/inth" | |
97 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/memif" | |
98 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/rhea" | |
99 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/security" | |
100 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/spi" | |
101 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/timer" | |
102 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/uart" | |
103 CPPFLAGS="$CPPFLAGS -I$SRC/cs/drivers/drv_core/ulpd" | |
104 CPPFLAGS="$CPPFLAGS -I$SRC/cs/system" | |
105 CPPFLAGS="$CPPFLAGS -I$SRC/cs/layer1/include" | |
106 CPPFLAGS="$CPPFLAGS -I$SRC/cs/services" | |
107 | |
108 # Source modules | |
109 | |
110 SRCDIR=$SRC/condat2/com/src/driver | |
111 | |
112 cfile_str2ind $SRCDIR/audio.c | |
113 cfile_str2ind $SRCDIR/display.c | |
114 cfile_str2ind $SRCDIR/keypad.c | |
115 cfile_str2ind $SRCDIR/light.c | |
116 cfile_str2ind $SRCDIR/power.c | |
117 cfile_str2ind $SRCDIR/rx.c | |
118 cfile_str2ind $SRCDIR/em.c | |
119 cfile_str2ind $SRCDIR/rtc.c | |
120 cfile_str2ind $SRCDIR/vmd.c | |
121 cfile_str2ind $SRCDIR/font_bitmaps.c | |
122 cfile_str2ind $SRCDIR/ffs_coat.c |