Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/bash/src/lib/malloc/malloc.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
15 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
16 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
18 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
19 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
22 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
28 | union mhead { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | char * mh_align; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | struct { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | char mi_alloc; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | char mi_index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
34 | unsigned short mi_magic2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
35 | unsigned int mi_nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
36 | } minfo; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
37 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
38 | typedef union _malloc_guard { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
39 | char s[4]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | unsigned int i; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | } mguard_t; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | static union mhead *nextf[30]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
44 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
46 | static char busy[30]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
48 | static int pagesz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | static int pagebucket; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | static int maxbuck; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
52 | static char *memtop; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
54 | static const unsigned long binsizes[30] = { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
55 | 8UL, 16UL, 32UL, 64UL, 128UL, 256UL, 512UL, 1024UL, 2048UL, 4096UL, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
56 | 8192UL, 16384UL, 32768UL, 65536UL, 131072UL, 262144UL, 524288UL, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | 1048576UL, 2097152UL, 4194304UL, 8388608UL, 16777216UL, 33554432UL, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | 67108864UL, 134217728UL, 268435456UL, 536870912UL, 1073741824UL, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | 2147483648UL, 4294967295UL | - | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | static void * internal_malloc (size_t, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
62 | static void * internal_realloc (void *, size_t, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | static void internal_free (void *, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
64 | static void * internal_memalign (size_t, size_t, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
66 | static void * internal_calloc (size_t, size_t, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
67 | static void internal_cfree (void *, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
70 | static void * internal_valloc (size_t, const char *, int, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
74 | extern void programming_error (); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
76 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
77 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
78 | static void xbotch (void *, int, const char *, const char *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
80 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
82 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
83 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
85 | extern int interrupt_immediately, running_trap; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
86 | extern int signal_is_trapped (int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
87 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
88 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
89 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
90 | struct _malstats _mstats; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
92 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
94 | int malloc_flags = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
95 | int malloc_trace = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | int malloc_register = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
98 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
99 | char _malloc_trace_buckets[30]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
100 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
102 | extern void mtrace_alloc (const char *, void *, size_t, const char *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | extern void mtrace_free (void *, int, const char *, int); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | xbotch (mem, e, s, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | int e; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | const char *s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
109 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
112 | fprintf ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | stderr | - | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
116 | "\r\nmalloc: %s:%d: assertion botched\r\n" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
117 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
118 | , | - | ||||||||||||||||||||||||||||||||||||||||||||||||
119 | file ? file : | - | ||||||||||||||||||||||||||||||||||||||||||||||||
120 | dcgettext (((void *)0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | "unknown" | - | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | , 5) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
123 | , line); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
125 | if (mem !=
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | && malloc_register
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | mregister_describe_mem (mem, never executed: mregister_describe_mem (mem, stderr ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | stderr never executed: mregister_describe_mem (mem, stderr ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
130 | ); never executed: mregister_describe_mem (mem, stderr ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
132 | (void)fflush ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
133 | stderr | - | ||||||||||||||||||||||||||||||||||||||||||||||||
134 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | programming_error(s, file, line); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
142 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
143 | bcoalesce (nu) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
144 | register int nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
146 | register union mhead *mp, *mp1, *mp2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | register int nbuck; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
148 | unsigned long siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
150 | nbuck = nu - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | if (nextf[nbuck] == 0
| 0-189187 | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
154 | busy[nbuck] = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | siz = binsizes[(nbuck)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
157 | mp2 = mp1 = nextf[nbuck]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | mp = (*(union mhead **) (sizeof (char *) + (char *) (mp1))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
159 | while (mp
| 24071-337004 | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
161 | mp2 = mp1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | mp1 = mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | mp = (*(union mhead **) (sizeof (char *) + (char *) (mp))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | } executed 171888 times by 1 test: end of block Executed by:
| 171888 | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
166 | if (mp == 0
| 24071-165116 | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
168 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
169 | return; executed 24071 times by 1 test: return; Executed by:
| 24071 | ||||||||||||||||||||||||||||||||||||||||||||||||
170 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
171 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
172 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
173 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
174 | if (mp2 != mp1
| 0-128147 | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | xbotch ((void *)0, 0, "bcoalesce: CHAIN(mp2) != mp1", (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
178 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | , 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
180 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
183 | if ((*(union
| 0-165116 | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
186 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
191 | if (mp1 == nextf[nbuck]
| 36969-128147 | ||||||||||||||||||||||||||||||||||||||||||||||||
192 | nextf[nbuck] = (*(union mhead **) (sizeof (char *) + (char *) (mp))); executed 128147 times by 1 test: nextf[nbuck] = (*(union mhead **) (sizeof (char *) + (char *) (mp))); Executed by:
| 128147 | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | (*(union executed 36969 times by 1 test: mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp)));(*(union mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp))); Executed by:
executed 36969 times by 1 test: (*(union mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp))); Executed by:
| 36969 | ||||||||||||||||||||||||||||||||||||||||||||||||
195 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
196 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
198 | _mstats.tbcoalesce++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
199 | _mstats.ncoalesce[nbuck]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
201 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
203 | mp1->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | mp1->minfo.mi_index = nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | (*(union mhead **) (sizeof (char *) + (char *) (mp1))) = nextf[nu]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | nextf[nu] = mp1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | } executed 165116 times by 1 test: end of block Executed by:
| 165116 | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
213 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | bsplit (nu) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | register int nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
216 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
217 | register union mhead *mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | int nbuck, nblks, split_max; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
219 | unsigned long siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
221 | split_max = (
| 203279-2975467 | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
223 | if (nu >= 11
| 13786-3164960 | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
225 | for (nbuck = split_max; nbuck > nu
| 13776-25847 | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | if (busy[nbuck]
| 0-25847 | ||||||||||||||||||||||||||||||||||||||||||||||||
228 | continue; executed 25837 times by 1 test: continue; Executed by:
| 25837 | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
231 | } executed 13786 times by 1 test: end of block Executed by:
| 13786 | ||||||||||||||||||||||||||||||||||||||||||||||||
232 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
233 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
234 | for (nbuck = nu + 1; nbuck <= split_max
| 329326-6486574 | ||||||||||||||||||||||||||||||||||||||||||||||||
235 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
236 | if (busy[nbuck]
| 0-6486574 | ||||||||||||||||||||||||||||||||||||||||||||||||
237 | continue; executed 3650940 times by 1 test: continue; Executed by:
| 3650940 | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | break; executed 2835634 times by 1 test: break; Executed by:
| 2835634 | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | } executed 3164960 times by 1 test: end of block Executed by:
| 3164960 | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
242 | if (nbuck > split_max
| 13776-2849420 | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | return; executed 343102 times by 1 test: return; Executed by:
| 343102 | ||||||||||||||||||||||||||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
248 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
249 | busy[nbuck] = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | mp = nextf[nbuck]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | nextf[nbuck] = (*(union mhead **) (sizeof (char *) + (char *) (mp))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
255 | _mstats.tbsplit++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
256 | _mstats.nsplit[nbuck]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
257 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
259 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
260 | siz = binsizes[(nu)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
261 | nblks = binsizes[(nbuck)] / siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
264 | nextf[nu] = mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | while (1) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
266 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | mp->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | mp->minfo.mi_index = nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | if (--
executed 2835644 times by 1 test: break; Executed by:
| 2835644-4839142 | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
271 | mp = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
272 | } executed 4839142 times by 1 test: end of block Executed by:
| 4839142 | ||||||||||||||||||||||||||||||||||||||||||||||||
273 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
274 | } executed 2835644 times by 1 test: end of block Executed by:
| 2835644 | ||||||||||||||||||||||||||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
277 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
278 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
279 | xsplit (mp, nu) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | union mhead *mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | int nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | union mhead *nh; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
284 | int nbuck, nblks, split_max; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
285 | unsigned long siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
287 | nbuck = nu - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
288 | while (nbuck >= 2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
289 | nbuck--; never executed: nbuck--; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
290 | if (nbuck < 2
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
294 | _mstats.tbsplit++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
295 | _mstats.nsplit[nu]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
296 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
297 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
299 | siz = binsizes[(nu)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
300 | nblks = siz / binsizes[(nbuck)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
303 | siz = binsizes[(nbuck)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
304 | nh = mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
305 | while (1) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
306 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
307 | mp->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
308 | mp->minfo.mi_index = nbuck; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
309 | if (--
never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
310 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
311 | mp = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
312 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | busy[nbuck] = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
314 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = nextf[nbuck]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
315 | nextf[nbuck] = nh; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
316 | busy[nbuck] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
317 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
319 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
320 | _malloc_block_signals (setp, osetp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
321 | sigset_t *setp, *osetp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
322 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
324 | sigfillset (setp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
325 | sigemptyset (osetp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | sigprocmask ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | 0 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
328 | , setp, osetp); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
329 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
332 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
333 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
334 | } executed 627432 times by 1 test: end of block Executed by:
| 627432 | ||||||||||||||||||||||||||||||||||||||||||||||||
335 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
336 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | _malloc_unblock_signals (setp, osetp) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
338 | sigset_t *setp, *osetp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
339 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
341 | sigprocmask ( | - | ||||||||||||||||||||||||||||||||||||||||||||||||
342 | 2 | - | ||||||||||||||||||||||||||||||||||||||||||||||||
343 | , osetp, (sigset_t *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
344 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
345 | ); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
347 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
351 | } executed 627432 times by 1 test: end of block Executed by:
| 627432 | ||||||||||||||||||||||||||||||||||||||||||||||||
352 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
353 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
356 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
357 | lesscore (nu) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
358 | register int nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
359 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
360 | long siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
361 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
362 | siz = binsizes[(nu)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
363 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
364 | sbrk (-siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | memtop -= siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
368 | _mstats.nsbrk++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
369 | _mstats.tsbrk -= siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
370 | _mstats.nlesscore[nu]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
371 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
372 | } executed 1722 times by 1 test: end of block Executed by:
| 1722 | ||||||||||||||||||||||||||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
375 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
376 | morecore (nu) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | register int nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
379 | register union mhead *mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | register int nblks; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | register long siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
382 | long sbrk_amt; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
383 | sigset_t set, oset; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
384 | int blocked_sigs; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
385 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
387 | blocked_sigs = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
388 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
390 | if (interrupt_immediately
| 0-3186477 | ||||||||||||||||||||||||||||||||||||||||||||||||
391 | 2
| 494-3181280 | ||||||||||||||||||||||||||||||||||||||||||||||||
392 | )
| 0-3181280 | ||||||||||||||||||||||||||||||||||||||||||||||||
393 | 17
| 0-3181280 | ||||||||||||||||||||||||||||||||||||||||||||||||
394 | )
| 0-3181280 | ||||||||||||||||||||||||||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
396 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
399 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
400 | _malloc_block_signals (&set, &oset); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
401 | blocked_sigs = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
402 | } executed 5197 times by 1 test: end of block Executed by:
| 5197 | ||||||||||||||||||||||||||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
404 | siz = binsizes[(nu)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
406 | if (siz < 0
| 0-3186477 | ||||||||||||||||||||||||||||||||||||||||||||||||
407 | goto never executed: morecore_done;goto morecore_done; never executed: goto morecore_done; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
409 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
410 | _mstats.nmorecore[nu]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
415 | if (nu >= 2
| 7731-3178746 | ||||||||||||||||||||||||||||||||||||||||||||||||
416 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
417 | bsplit (nu); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
418 | if (nextf[nu] != 0
| 343102-2835644 | ||||||||||||||||||||||||||||||||||||||||||||||||
419 | goto executed 2835644 times by 1 test: morecore_done;goto morecore_done; Executed by:
executed 2835644 times by 1 test: goto morecore_done; Executed by:
| 2835644 | ||||||||||||||||||||||||||||||||||||||||||||||||
420 | } executed 343102 times by 1 test: end of block Executed by:
| 343102 | ||||||||||||||||||||||||||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
422 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
424 | if (nu >= 2
| 0-343102 | ||||||||||||||||||||||||||||||||||||||||||||||||
425 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
426 | bcoalesce (nu); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
427 | if (nextf[nu] != 0
| 24071-165116 | ||||||||||||||||||||||||||||||||||||||||||||||||
428 | goto executed 165116 times by 1 test: morecore_done;goto morecore_done; Executed by:
executed 165116 times by 1 test: goto morecore_done; Executed by:
| 165116 | ||||||||||||||||||||||||||||||||||||||||||||||||
429 | } executed 24071 times by 1 test: end of block Executed by:
| 24071 | ||||||||||||||||||||||||||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
433 | if (siz <= pagesz
| 37908-147809 | ||||||||||||||||||||||||||||||||||||||||||||||||
434 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
435 | sbrk_amt = pagesz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
436 | nblks = sbrk_amt / siz; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
437 | } executed 147809 times by 1 test: end of block Executed by:
| 147809 | ||||||||||||||||||||||||||||||||||||||||||||||||
438 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
439 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
443 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
445 | sbrk_amt = siz & (pagesz - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
446 | if (sbrk_amt == 0
| 0-37908 | ||||||||||||||||||||||||||||||||||||||||||||||||
447 | sbrk_amt = siz; executed 37908 times by 1 test: sbrk_amt = siz; Executed by:
| 37908 | ||||||||||||||||||||||||||||||||||||||||||||||||
448 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
449 | sbrk_amt = siz + pagesz - sbrk_amt; never executed: sbrk_amt = siz + pagesz - sbrk_amt; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
450 | nblks = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
451 | } executed 37908 times by 1 test: end of block Executed by:
| 37908 | ||||||||||||||||||||||||||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
453 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
454 | _mstats.nsbrk++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
455 | _mstats.tsbrk += sbrk_amt; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
457 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
458 | mp = (union mhead *) sbrk (sbrk_amt); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
460 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
461 | if ((
| 0-185717 | ||||||||||||||||||||||||||||||||||||||||||||||||
462 | goto never executed: morecore_done;goto morecore_done; never executed: goto morecore_done; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
464 | memtop += sbrk_amt; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
465 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
467 | if ((
| 0-185717 | ||||||||||||||||||||||||||||||||||||||||||||||||
468 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
469 | mp = (union mhead *) (((long)mp + 7) & ~7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
470 | nblks--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
474 | nextf[nu] = mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
475 | while (1) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
476 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
477 | mp->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
478 | mp->minfo.mi_index = nu; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
479 | if (--
executed 185717 times by 1 test: break; Executed by:
| 185717-6130904 | ||||||||||||||||||||||||||||||||||||||||||||||||
480 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
481 | mp = (union mhead *)((char *)mp + siz); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
482 | } executed 6130904 times by 1 test: end of block Executed by:
| 6130904 | ||||||||||||||||||||||||||||||||||||||||||||||||
483 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
485 | morecore_done: code before this statement executed 185717 times by 1 test: morecore_done: Executed by:
| 185717 | ||||||||||||||||||||||||||||||||||||||||||||||||
486 | if (blocked_sigs
| 5197-3181280 | ||||||||||||||||||||||||||||||||||||||||||||||||
487 | _malloc_unblock_signals (&set, &oset); executed 5197 times by 1 test: _malloc_unblock_signals (&set, &oset); Executed by:
| 5197 | ||||||||||||||||||||||||||||||||||||||||||||||||
488 | } executed 3186477 times by 1 test: end of block Executed by:
| 3186477 | ||||||||||||||||||||||||||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
490 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
491 | malloc_debug_dummy () | - | ||||||||||||||||||||||||||||||||||||||||||||||||
492 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
493 | write (1, "malloc_debug_dummy\n", 19); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
494 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
497 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
499 | static int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
500 | pagealign () | - | ||||||||||||||||||||||||||||||||||||||||||||||||
501 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
502 | register int nunits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
503 | register union mhead *mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
504 | long sbrk_needed; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
505 | char *curbrk; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
506 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
507 | pagesz = getpagesize (); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
508 | if (pagesz < 1024
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
509 | pagesz = 1024; never executed: pagesz = 1024; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
510 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
515 | memtop = curbrk = sbrk (0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
516 | sbrk_needed = pagesz - ((long)curbrk & (pagesz - 1)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
517 | if (sbrk_needed < 0
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
518 | sbrk_needed += pagesz; never executed: sbrk_needed += pagesz; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
521 | if (sbrk_needed
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
522 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
523 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
524 | _mstats.nsbrk++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
525 | _mstats.tsbrk += sbrk_needed; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
526 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
527 | curbrk = sbrk (sbrk_needed); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
528 | if ((
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
529 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
530 | memtop += sbrk_needed; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
536 | curbrk += sbrk_needed & (32 - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
537 | sbrk_needed -= sbrk_needed & (32 - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
538 | nunits = sbrk_needed / 32; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
539 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
540 | if (nunits > 0
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
541 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
542 | mp = (union mhead *)curbrk; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
544 | nextf[2] = mp; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
545 | while (1) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
546 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
547 | mp->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
548 | mp->minfo.mi_index = 2; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
549 | if (--
executed 5432 times by 1 test: break; Executed by:
| 5432-689864 | ||||||||||||||||||||||||||||||||||||||||||||||||
550 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = (union mhead *)((char *)mp + 32); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
551 | mp = (union mhead *)((char *)mp + 32); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
552 | } executed 689864 times by 1 test: end of block Executed by:
| 689864 | ||||||||||||||||||||||||||||||||||||||||||||||||
553 | (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
554 | } executed 5432 times by 1 test: end of block Executed by:
| 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
555 | } executed 5432 times by 1 test: end of block Executed by:
| 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
557 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
558 | for (nunits = 7; nunits < 30
| 0-16296 | ||||||||||||||||||||||||||||||||||||||||||||||||
559 | if (pagesz <= binsizes[(nunits)]
| 5432-10864 | ||||||||||||||||||||||||||||||||||||||||||||||||
560 | break; executed 5432 times by 1 test: break; Executed by:
| 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
561 | pagebucket = nunits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
563 | return executed 5432 times by 1 test: 0;return 0; Executed by:
executed 5432 times by 1 test: return 0; Executed by:
| 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
564 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
565 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
566 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
567 | internal_malloc (n, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
568 | size_t n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
569 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
570 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
571 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
572 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
573 | register int nunits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
574 | register char *m, *z; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
575 | long nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
576 | mguard_t mg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
578 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
581 | if (pagesz == 0
| 5432-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
582 | if (pagealign () < 0
| 0-5432 | ||||||||||||||||||||||||||||||||||||||||||||||||
583 | return never executed: ((void *)return ((void *) ((void *)0) ); never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
584 | ((void *)0) never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
585 | ); never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
589 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
590 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
591 | nbytes = (((n) + sizeof(union mhead) + 4 + 7) & ~7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
592 | nunits = (
| 57895586-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
593 | for ( ; nunits < 30
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
594 | if (nbytes <= binsizes[(nunits)]
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
595 | break; executed 2147483647 times by 1 test: break; Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
598 | if (nunits >= 30
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
599 | return never executed: ((void *) return ((void *) ((void *)0) ); never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
600 | ((void *)0) never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
601 | ); never executed: return ((void *) ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
602 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
603 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
608 | if (busy[nunits]
never executed: _mstats.nrecurse++; | 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
610 | while (busy[nunits]
never executed: nunits++; | 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
611 | busy[nunits] = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
613 | if (nunits > maxbuck
| 27177-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
614 | maxbuck = nunits; executed 27177 times by 1 test: maxbuck = nunits; Executed by:
| 27177 | ||||||||||||||||||||||||||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
617 | if (nextf[nunits] == 0
| 3186477-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
618 | morecore (nunits); executed 3186477 times by 1 test: morecore (nunits); Executed by:
| 3186477 | ||||||||||||||||||||||||||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
621 | if ((
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
622 | ((void *)0)
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
623 | ) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
624 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
625 | busy[nunits] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
626 | return never executed: return ((void *)0) ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
627 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
628 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
629 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
630 | nextf[nunits] = (*(union mhead **) (sizeof (char *) + (char *) (p))); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
631 | busy[nunits] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
636 | if (p->minfo.mi_alloc != ((char) 0x54)
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
637 | xbotch ((void *)(p+1), 0, never executed: xbotch ((void *)(p+1), 0, dcgettext (((void *)0), "malloc: block on free list clobbered" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
638 | dcgettext (((void *)0), never executed: xbotch ((void *)(p+1), 0, dcgettext (((void *)0), "malloc: block on free list clobbered" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
639 | "malloc: block on free list clobbered" never executed: xbotch ((void *)(p+1), 0, dcgettext (((void *)0), "malloc: block on free list clobbered" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
640 | , 5) never executed: xbotch ((void *)(p+1), 0, dcgettext (((void *)0), "malloc: block on free list clobbered" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
641 | , file, line); never executed: xbotch ((void *)(p+1), 0, dcgettext (((void *)0), "malloc: block on free list clobbered" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
643 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
644 | p->minfo.mi_alloc = ((char) 0xf7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
645 | p->minfo.mi_magic2 = 0x5555; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
646 | p->minfo.mi_nbytes = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
647 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
649 | mg.i = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
650 | z = mg.s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
651 | m = (char *) (p + 1) + n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
652 | *m++ = *z++, *m++ = *z++, *m++ = *z++, *m++ = *z++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
654 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
655 | if (n
| 80-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
656 | do { if ((
executed 1162447761 times by 1 test: else { mcn = (mctmp-1)/8; mctmp &= 7; }mcn = 0; Executed by:
executed 1176959061 times by 1 test: switch (mctmp) { caseend of block Executed by:
executed 784811589 times by 1 test: 0:case 0: Executed by:
executed 784811589 times by 1 test: for(;;) { *mzp++ = 0xdf; casecase 0: Executed by:
executed 72406154 times by 1 test: 7:case 7: Executed by:
executed 72406154 times by 1 test: case 7: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 7: Executed by:
executed 103837580 times by 1 test: 6:case 6: Executed by:
executed 103837580 times by 1 test: case 6: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 6: Executed by:
executed 173970909 times by 1 test: 5:case 5: Executed by:
executed 173970909 times by 1 test: case 5: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 5: Executed by:
executed 121802483 times by 1 test: 4:case 4: Executed by:
executed 121802483 times by 1 test: case 4: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 4: Executed by:
executed 313187203 times by 1 test: 3:case 3: Executed by:
executed 313187203 times by 1 test: case 3: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 3: Executed by:
executed 601789411 times by 1 test: 2:case 2: Executed by:
executed 601789411 times by 1 test: case 2: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; casecase 2: Executed by:
executed 167601493 times by 1 test: 1:case 1: Executed by:
executed 167601493 times by 1 test: case 1: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xdf; if(mcn <= 0case 1: Executed by:
executed 2147483647 times by 1 test: mcn--; }break; Executed by:
executed 2147483647 times by 1 test: }end of block Executed by:
executed 2147483647 times by 1 test: }end of block Executed by:
executed 2147483647 times by 1 test: else memset (((char *)(p + 1)), (0xdf), (n));end of block Executed by:
executed 399801898 times by 1 test: }memset (((char *)(p + 1)), (0xdf), (n)); Executed by:
executed 2147483647 times by 1 test: while(0);end of block Executed by:
| 72406154-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
657 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
658 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
659 | _mstats.nmalloc[nunits]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
660 | _mstats.tmalloc[nunits]++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
661 | _mstats.nmal++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
662 | _mstats.bytesreq += n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
663 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
665 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
666 | if (malloc_trace
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
667 | mtrace_alloc ("malloc", p + 1, n, file, line); never executed: mtrace_alloc ("malloc", p + 1, n, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
668 | else if (_malloc_trace_buckets[nunits]
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
669 | mtrace_alloc ("malloc", p + 1, n, file, line); never executed: mtrace_alloc ("malloc", p + 1, n, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
670 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
673 | if (malloc_register
| 35046-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
674 | mregister_alloc ("malloc", p + 1, n, file, line); executed 2147483647 times by 1 test: mregister_alloc ("malloc", p + 1, n, file, line); Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
676 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
677 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
678 | if (_malloc_nwatch > 0
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
679 | _malloc_ckwatch (p + 1, file, line, 0x01, n); never executed: _malloc_ckwatch (p + 1, file, line, 0x01, n); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
682 | return executed 2147483647 times by 1 test: (void *) (p + 1);return (void *) (p + 1); Executed by:
executed 2147483647 times by 1 test: return (void *) (p + 1); Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
683 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
684 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
685 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
686 | internal_free (mem, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
687 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
688 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
689 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
690 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
691 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
692 | register char *ap, *z; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
693 | register int nunits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
694 | register unsigned int nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
695 | int ubytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
696 | mguard_t mg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
698 | if ((
| 66190-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
699 | return; executed 66190 times by 1 test: return; Executed by:
| 66190 | ||||||||||||||||||||||||||||||||||||||||||||||||
700 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
701 | p = (union mhead *) ap - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
702 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
703 | if (p->minfo.mi_alloc == ((char) 0xd6)
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
704 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
705 | ap -= p->minfo.mi_nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
706 | p = (union mhead *) ap - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
707 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
708 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
709 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
710 | if (malloc_trace
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
711 | ubytes = p->minfo.mi_nbytes; executed 2147483647 times by 1 test: ubytes = p->minfo.mi_nbytes; Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
712 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
714 | if (p->minfo.mi_alloc != ((char) 0xf7)
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
715 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
716 | if (p->minfo.mi_alloc == ((char) 0x54)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
717 | xbotch (mem, 0x01, never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
718 | never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
719 | dcgettext (((void *)0), never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
720 | "free: called with already freed block argument" never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
721 | , 5) never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
722 | , file, line); never executed: xbotch (mem, 0x01, dcgettext (((void *)0), "free: called with already freed block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
723 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
724 | xbotch (mem, 0x02, never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
725 | never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
726 | dcgettext (((void *)0), never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
727 | "free: called with unallocated block argument" never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
728 | , 5) never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
729 | , file, line); never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "free: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
730 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
732 | do { if (!(p->minfo.mi_magic2 == 0x5555)
never executed: } while (0);xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line); | 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
733 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
734 | nunits = p->minfo.mi_index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
735 | nbytes = (((p->minfo.mi_nbytes) + sizeof(union mhead) + 4 + 7) & ~7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
736 | if (((
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
737 | xbotch (mem, 0x04, never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
738 | never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
739 | dcgettext (((void *)0), never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
740 | "free: underflow detected; mh_nbytes out of range" never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
741 | , 5) never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
742 | , file, line); never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "free: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
743 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
744 | ap += p->minfo.mi_nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
745 | z = mg.s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
746 | *z++ = *ap++, *z++ = *ap++, *z++ = *ap++, *z++ = *ap++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
747 | if (mg.i != p->minfo.mi_nbytes
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
748 | xbotch (mem, 0x08, never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "free: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
749 | dcgettext (((void *)0), never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "free: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
750 | "free: start and end chunk sizes differ" never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "free: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
751 | , 5) never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "free: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
752 | , file, line); never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "free: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
756 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
757 | if (nunits >= 10
| 521916-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
759 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
760 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
761 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
764 | if ((
| 0-57334886 | ||||||||||||||||||||||||||||||||||||||||||||||||
765 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
766 | lesscore (nunits); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
767 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
768 | goto executed 1722 times by 1 test: free_return;goto free_return; Executed by:
executed 1722 times by 1 test: goto free_return; Executed by:
| 1722 | ||||||||||||||||||||||||||||||||||||||||||||||||
769 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
770 | } executed 57334862 times by 1 test: end of block Executed by:
| 57334862 | ||||||||||||||||||||||||||||||||||||||||||||||||
771 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
772 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
773 | if (p->minfo.mi_nbytes
| 80-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
774 | do { if ((
executed 1160792681 times by 1 test: else { mcn = (mctmp-1)/8; mctmp &= 7; }mcn = 0; Executed by:
executed 1169118356 times by 1 test: switch (mctmp) { caseend of block Executed by:
executed 778061153 times by 1 test: 0:case 0: Executed by:
executed 778061153 times by 1 test: for(;;) { *mzp++ = 0xcf; casecase 0: Executed by:
executed 72168244 times by 1 test: 7:case 7: Executed by:
executed 72168244 times by 1 test: case 7: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 7: Executed by:
executed 103651051 times by 1 test: 6:case 6: Executed by:
executed 103651051 times by 1 test: case 6: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 6: Executed by:
executed 173376289 times by 1 test: 5:case 5: Executed by:
executed 173376289 times by 1 test: case 5: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 5: Executed by:
executed 121350200 times by 1 test: 4:case 4: Executed by:
executed 121350200 times by 1 test: case 4: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 4: Executed by:
executed 312755919 times by 1 test: 3:case 3: Executed by:
executed 312755919 times by 1 test: case 3: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 3: Executed by:
executed 601138706 times by 1 test: 2:case 2: Executed by:
executed 601138706 times by 1 test: case 2: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; casecase 2: Executed by:
executed 167409475 times by 1 test: 1:case 1: Executed by:
executed 167409475 times by 1 test: case 1: Executed by:
code before this statement executed 2147483647 times by 1 test: *mzp++ = 0xcf; if(mcn <= 0case 1: Executed by:
executed 2147483647 times by 1 test: mcn--; }break; Executed by:
executed 2147483647 times by 1 test: }end of block Executed by:
executed 2147483647 times by 1 test: }end of block Executed by:
executed 2147483647 times by 1 test: else memset ((mem), (0xcf), (p->minfo.mi_nbytes));end of block Executed by:
executed 398923759 times by 1 test: }memset ((mem), (0xcf), (p->minfo.mi_nbytes)); Executed by:
executed 2147483647 times by 1 test: while(0);end of block Executed by:
| 72168244-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
775 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
776 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
777 | do { if (!(nunits < 30)
never executed: } while (0);xbotch((void *)0, 0x08, "nunits < 30", file, line); | 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
778 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
779 | if (busy[nunits] == 1
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
780 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
781 | xsplit (p, nunits); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
782 | goto never executed: free_return;goto free_return; never executed: goto free_return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
783 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
785 | p->minfo.mi_alloc = ((char) 0x54); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
787 | busy[nunits] = 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
788 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
789 | (*(union mhead **) (sizeof (char *) + (char *) (p))) = nextf[nunits]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
790 | nextf[nunits] = p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
791 | busy[nunits] = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
793 | free_return: code before this statement executed 2147483647 times by 1 test: free_return: Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
794 | ; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
797 | _mstats.nmalloc[nunits]--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
798 | _mstats.nfre++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
801 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
802 | if (malloc_trace
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
803 | mtrace_free (mem, ubytes, file, line); never executed: mtrace_free (mem, ubytes, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
804 | else if (_malloc_trace_buckets[nunits]
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
805 | mtrace_free (mem, ubytes, file, line); never executed: mtrace_free (mem, ubytes, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
806 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
807 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
809 | if (malloc_register
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
810 | mregister_free (mem, ubytes, file, line); executed 2147483647 times by 1 test: mregister_free (mem, ubytes, file, line); Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
813 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
814 | if (_malloc_nwatch > 0
| 0-Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
815 | _malloc_ckwatch (mem, file, line, 0x02, ubytes); never executed: _malloc_ckwatch (mem, file, line, 0x02, ubytes); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
817 | } executed 2147483647 times by 1 test: end of block Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
819 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
820 | internal_realloc (mem, n, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
821 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
822 | register size_t n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
823 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
824 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
825 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
826 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
827 | register unsigned int tocopy; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
828 | register unsigned int nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
829 | register int nunits; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
830 | register char *m, *z; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
831 | mguard_t mg; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
833 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
834 | _mstats.nrealloc++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
837 | if (n == 0
| 0-4729931 | ||||||||||||||||||||||||||||||||||||||||||||||||
838 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
839 | internal_free (mem, file, line, 0x02); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
840 | return never executed: (return ( ((void *)0) ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
841 | ((void *)0) never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
842 | ); never executed: return ( ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
843 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
844 | if ((
| 94032-4635899 | ||||||||||||||||||||||||||||||||||||||||||||||||
845 | return executed 4635899 times by 1 test: internal_malloc (n, file, line, 0x02);return internal_malloc (n, file, line, 0x02); Executed by:
executed 4635899 times by 1 test: return internal_malloc (n, file, line, 0x02); Executed by:
| 4635899 | ||||||||||||||||||||||||||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
847 | p--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
848 | nunits = p->minfo.mi_index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
849 | do { if (!(nunits < 30)
never executed: } while (0);xbotch((void *)0, 0x08, "nunits < 30", file, line); | 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
851 | if (p->minfo.mi_alloc != ((char) 0xf7)
| 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
852 | xbotch (mem, 0x02, never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
853 | never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
854 | dcgettext (((void *)0), never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
855 | "realloc: called with unallocated block argument" never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
856 | , 5) never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
857 | , file, line); never executed: xbotch (mem, 0x02, dcgettext (((void *)0), "realloc: called with unallocated block argument" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
858 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
859 | do { if (!(p->minfo.mi_magic2 == 0x5555)
never executed: } while (0);xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line); | 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
860 | nbytes = (((p->minfo.mi_nbytes) + sizeof(union mhead) + 4 + 7) & ~7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
861 | if (((
| 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
862 | xbotch (mem, 0x04, never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
863 | never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
864 | dcgettext (((void *)0), never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
865 | "realloc: underflow detected; mh_nbytes out of range" never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
866 | , 5) never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
867 | , file, line); never executed: xbotch (mem, 0x04, dcgettext (((void *)0), "realloc: underflow detected; mh_nbytes out of range" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
868 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
869 | m = (char *)mem + (tocopy = p->minfo.mi_nbytes); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
870 | z = mg.s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
871 | *z++ = *m++, *z++ = *m++, *z++ = *m++, *z++ = *m++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
872 | if (mg.i != p->minfo.mi_nbytes
| 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
873 | xbotch (mem, 0x08, never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "realloc: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
874 | dcgettext (((void *)0), never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "realloc: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
875 | "realloc: start and end chunk sizes differ" never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "realloc: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
876 | , 5) never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "realloc: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
877 | , file, line); never executed: xbotch (mem, 0x08, dcgettext (((void *)0), "realloc: start and end chunk sizes differ" , 5) , file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
878 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
879 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
880 | if (_malloc_nwatch > 0
| 0-94032 | ||||||||||||||||||||||||||||||||||||||||||||||||
881 | _malloc_ckwatch (p + 1, file, line, 0x04, n); never executed: _malloc_ckwatch (p + 1, file, line, 0x04, n); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
882 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
883 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
884 | _mstats.bytesreq += (
| 101-93931 | ||||||||||||||||||||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
886 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
887 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
888 | if (n == p->minfo.mi_nbytes
| 167-93865 | ||||||||||||||||||||||||||||||||||||||||||||||||
889 | return executed 167 times by 1 test: mem;return mem; Executed by:
executed 167 times by 1 test: return mem; Executed by:
| 167 | ||||||||||||||||||||||||||||||||||||||||||||||||
890 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
891 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
892 | nbytes = (((n) + sizeof(union mhead) + 4 + 7) & ~7); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
895 | if ((((
| 4-93765 | ||||||||||||||||||||||||||||||||||||||||||||||||
896 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
901 | m -= 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
903 | *m++ = 0; *m++ = 0; *m++ = 0; *m++ = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
904 | m = (char *)mem + (p->minfo.mi_nbytes = n); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
905 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
906 | mg.i = n; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
907 | z = mg.s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
908 | *m++ = *z++, *m++ = *z++, *m++ = *z++, *m++ = *z++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
910 | return executed 58819 times by 1 test: mem;return mem; Executed by:
executed 58819 times by 1 test: return mem; Executed by:
| 58819 | ||||||||||||||||||||||||||||||||||||||||||||||||
911 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
912 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
913 | if (n < tocopy
| 96-34950 | ||||||||||||||||||||||||||||||||||||||||||||||||
914 | tocopy = n; executed 96 times by 1 test: tocopy = n; Executed by:
| 96 | ||||||||||||||||||||||||||||||||||||||||||||||||
915 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
916 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
917 | _mstats.nrcopy++; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
919 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
920 | if ((
| 0-35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
921 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
922 | __builtin_memcpy (m, mem, tocopy); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
923 | internal_free (mem, file, line, 0x02); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
926 | if (malloc_trace
| 0-35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
927 | mtrace_alloc ("realloc", m, n, file, line); never executed: mtrace_alloc ("realloc", m, n, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
928 | else if (_malloc_trace_buckets[nunits]
| 0-35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
929 | mtrace_alloc ("realloc", m, n, file, line); never executed: mtrace_alloc ("realloc", m, n, file, line); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
932 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
933 | if (malloc_register
| 0-35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
934 | mregister_alloc ("realloc", m, n, file, line); executed 35046 times by 1 test: mregister_alloc ("realloc", m, n, file, line); Executed by:
| 35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
935 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
937 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
938 | if (_malloc_nwatch > 0
| 0-35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
939 | _malloc_ckwatch (m, file, line, 0x08, n); never executed: _malloc_ckwatch (m, file, line, 0x08, n); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
940 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
941 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
942 | return executed 35046 times by 1 test: m;return m; Executed by:
executed 35046 times by 1 test: return m; Executed by:
| 35046 | ||||||||||||||||||||||||||||||||||||||||||||||||
943 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
944 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
945 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
946 | internal_memalign (alignment, size, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
947 | size_t alignment; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
948 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
949 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
950 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
951 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
952 | register char *ptr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
953 | register char *aligned; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
954 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
956 | ptr = internal_malloc (size + alignment, file, line, 0x02); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
957 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
958 | if (ptr == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
959 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
961 | if (((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
962 | return never executed: ptr;return ptr; never executed: return ptr; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
967 | aligned = (char *) (((long) ptr + alignment - 1) & (~alignment + 1)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
970 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
972 | p = (union mhead *) aligned - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
973 | p->minfo.mi_nbytes = aligned - ptr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
974 | p->minfo.mi_alloc = ((char) 0xd6); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
976 | return never executed: aligned;return aligned; never executed: return aligned; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
977 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
978 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
979 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
980 | posix_memalign (memptr, alignment, size) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
981 | void **memptr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
982 | size_t alignment, size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
983 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
984 | void *mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
985 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
986 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
987 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
988 | return never executed: return 22 ; never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
989 | 22 never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
990 | ; never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
991 | else if (((((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
992 | return never executed: return 22 ; never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
993 | 22 never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
994 | ; never executed: return 22 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
996 | mem = internal_memalign (alignment, size, (char *)0, 0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
997 | if (mem != 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
998 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
999 | *memptr = mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1000 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1001 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1002 | return never executed: return 12 ; never executed: return 12 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1003 | 12 never executed: return 12 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1004 | ; never executed: return 12 ; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1005 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1006 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1007 | size_t | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1008 | malloc_usable_size (mem) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1009 | void *mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1010 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1011 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1012 | register char *ap; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1013 | register int maxbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1014 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1015 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1016 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1017 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1018 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1019 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1020 | p = (union mhead *) ap - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1021 | if (p->minfo.mi_alloc == ((char) 0xd6)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1022 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1023 | ap -= p->minfo.mi_nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1024 | p = (union mhead *) ap - 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1025 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1027 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1028 | maxbytes = binsizes[(p->minfo.mi_index)]; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1029 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1030 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1031 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1032 | maxbytes -= sizeof(union mhead) + 4; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1033 | return never executed: (maxbytes);return (maxbytes); never executed: return (maxbytes); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1034 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1035 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1036 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1037 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1038 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1039 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1040 | internal_valloc (size, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1041 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1042 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1043 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1044 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1045 | return never executed: internal_memalign (getpagesize (), size, file, line, flags|0x02);return internal_memalign (getpagesize (), size, file, line, flags|0x02); never executed: return internal_memalign (getpagesize (), size, file, line, flags|0x02); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1046 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1047 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1048 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1049 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1050 | static void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1051 | internal_calloc (n, s, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1052 | size_t n, s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1053 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1054 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1055 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1056 | size_t total; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1057 | void * result; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1058 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1059 | total = n * s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1060 | result = internal_malloc (total, file, line, flags|0x02); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1061 | if (result
| 0-5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1062 | memset (result, 0, total); executed 5936 times by 1 test: memset (result, 0, total); Executed by:
| 5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1063 | return executed 5936 times by 1 test: result;return result; Executed by:
executed 5936 times by 1 test: return result; Executed by:
| 5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1064 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1065 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1066 | static void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1067 | internal_cfree (p, file, line, flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1068 | void * p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1069 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1070 | int line, flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1071 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1072 | internal_free (p, file, line, flags|0x02); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1073 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1076 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1077 | int | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1078 | malloc_free_blocks (size) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1079 | int size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1080 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1081 | int nfree; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1082 | register union mhead *p; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1083 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1084 | nfree = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1085 | for (p = nextf[size]; p
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1086 | nfree++; never executed: nfree++; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1088 | return never executed: nfree;return nfree; never executed: return nfree; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1089 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1090 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1091 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1092 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1093 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1094 | sh_malloc (bytes, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1095 | size_t bytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1096 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1097 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1098 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1099 | return executed 2147483647 times by 1 test: internal_malloc (bytes, file, line, 0x01);return internal_malloc (bytes, file, line, 0x01); Executed by:
executed 2147483647 times by 1 test: return internal_malloc (bytes, file, line, 0x01); Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
1100 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1101 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1102 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1103 | sh_realloc (ptr, size, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1104 | void * ptr; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1105 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1106 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1107 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1108 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1109 | return executed 92882 times by 1 test: internal_realloc (ptr, size, file, line, 0x01);return internal_realloc (ptr, size, file, line, 0x01); Executed by:
executed 92882 times by 1 test: return internal_realloc (ptr, size, file, line, 0x01); Executed by:
| 92882 | ||||||||||||||||||||||||||||||||||||||||||||||||
1110 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1112 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1113 | sh_free (mem, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1114 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1115 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1116 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1117 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1118 | internal_free (mem, file, line, 0x01); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1119 | } executed 2147483647 times by 1 test: end of block Executed by:
| Inf | ||||||||||||||||||||||||||||||||||||||||||||||||
1120 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1121 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1122 | sh_memalign (alignment, size, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1123 | size_t alignment; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1124 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1125 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1126 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1127 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1128 | return never executed: internal_memalign (alignment, size, file, line, 0x01);return internal_memalign (alignment, size, file, line, 0x01); never executed: return internal_memalign (alignment, size, file, line, 0x01); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1129 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1130 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1132 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1133 | sh_calloc (n, s, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1134 | size_t n, s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1135 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1136 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1137 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1138 | return never executed: internal_calloc (n, s, file, line, 0x01);return internal_calloc (n, s, file, line, 0x01); never executed: return internal_calloc (n, s, file, line, 0x01); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1139 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1141 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1142 | sh_cfree (mem, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1143 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1144 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1145 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1146 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1147 | internal_cfree (mem, file, line, 0x01); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1148 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1149 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1150 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1151 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1152 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1153 | sh_valloc (size, file, line) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1154 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1155 | const char *file; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1156 | int line; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1157 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1158 | return never executed: internal_valloc (size, file, line, 0x01);return internal_valloc (size, file, line, 0x01); never executed: return internal_valloc (size, file, line, 0x01); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1159 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1160 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1161 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1162 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1163 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1164 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1165 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1166 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1167 | malloc (size) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1168 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1169 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1170 | return executed 116973081 times by 1 test: internal_malloc (size, (char *)return internal_malloc (size, (char *) ((void *)0) , 0, 0); Executed by:
executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0); Executed by:
| 116973081 | ||||||||||||||||||||||||||||||||||||||||||||||||
1171 | ((void *)0) executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0); Executed by:
| 116973081 | ||||||||||||||||||||||||||||||||||||||||||||||||
1172 | , 0, 0); executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0); Executed by:
| 116973081 | ||||||||||||||||||||||||||||||||||||||||||||||||
1173 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1175 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1176 | realloc (mem, nbytes) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1177 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1178 | size_t nbytes; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1179 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1180 | return executed 4637049 times by 1 test: internal_realloc (mem, nbytes, (char *)return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0); Executed by:
executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0); Executed by:
| 4637049 | ||||||||||||||||||||||||||||||||||||||||||||||||
1181 | ((void *)0) executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0); Executed by:
| 4637049 | ||||||||||||||||||||||||||||||||||||||||||||||||
1182 | , 0, 0); executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0); Executed by:
| 4637049 | ||||||||||||||||||||||||||||||||||||||||||||||||
1183 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1184 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1185 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1186 | free (mem) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1187 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1188 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1189 | internal_free (mem, (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1190 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1191 | , 0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1192 | } executed 115886356 times by 1 test: end of block Executed by:
| 115886356 | ||||||||||||||||||||||||||||||||||||||||||||||||
1193 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1194 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1195 | memalign (alignment, size) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1196 | size_t alignment; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1197 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1198 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1199 | return never executed: internal_memalign (alignment, size, (char *)return internal_memalign (alignment, size, (char *) ((void *)0) , 0, 0); never executed: return internal_memalign (alignment, size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1200 | ((void *)0) never executed: return internal_memalign (alignment, size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1201 | , 0, 0); never executed: return internal_memalign (alignment, size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1202 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1205 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1206 | valloc (size) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1207 | size_t size; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1208 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1209 | return never executed: internal_valloc (size, (char *)return internal_valloc (size, (char *) ((void *)0) , 0, 0); never executed: return internal_valloc (size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1210 | ((void *)0) never executed: return internal_valloc (size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1211 | , 0, 0); never executed: return internal_valloc (size, (char *) ((void *)0) , 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1212 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1216 | void * | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1217 | calloc (n, s) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1218 | size_t n, s; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1219 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1220 | return executed 5936 times by 1 test: internal_calloc (n, s, (char *)return internal_calloc (n, s, (char *) ((void *)0) , 0, 0); Executed by:
executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0); Executed by:
| 5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1221 | ((void *)0) executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0); Executed by:
| 5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1222 | , 0, 0); executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0); Executed by:
| 5936 | ||||||||||||||||||||||||||||||||||||||||||||||||
1223 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1224 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1225 | void | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1226 | cfree (mem) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1227 | void * mem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1228 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1229 | internal_cfree (mem, (char *) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1230 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1231 | , 0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1232 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |