OpenCoverage

malloc.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/bash/src/lib/malloc/malloc.c
Switch to Source codePreprocessed file
LineSourceCount
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-
28union 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};-
38typedef union _malloc_guard {-
39 char s[4];-
40 unsigned int i;-
41} mguard_t;-
42static union mhead *nextf[30];-
43-
44-
45-
46static char busy[30];-
47-
48static int pagesz;-
49static int pagebucket;-
50static int maxbuck;-
51-
52static char *memtop;-
53-
54static 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};-
61static void * internal_malloc (size_t, const char *, int, int);-
62static void * internal_realloc (void *, size_t, const char *, int, int);-
63static void internal_free (void *, const char *, int, int);-
64static void * internal_memalign (size_t, size_t, const char *, int, int);-
65-
66static void * internal_calloc (size_t, size_t, const char *, int, int);-
67static void internal_cfree (void *, const char *, int, int);-
68-
69-
70static void * internal_valloc (size_t, const char *, int, int);-
71-
72-
73-
74extern void programming_error ();-
75-
76-
77-
78static void xbotch (void *, int, const char *, const char *, int);-
79-
80-
81-
82-
83-
84-
85extern int interrupt_immediately, running_trap;-
86extern int signal_is_trapped (int);-
87-
88-
89-
90struct _malstats _mstats;-
91-
92-
93-
94int malloc_flags = 0;-
95int malloc_trace = 0;-
96int malloc_register = 0;-
97-
98-
99char _malloc_trace_buckets[30];-
100-
101-
102extern void mtrace_alloc (const char *, void *, size_t, const char *, int);-
103extern void mtrace_free (void *, int, const char *, int);-
104static void-
105xbotch (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 !=
mem != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
126 ((void *)0)
mem != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
127 && malloc_register
malloc_registerDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
142static void-
143bcoalesce (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
nextf[nbuck] == 0Description
TRUEnever evaluated
FALSEevaluated 189187 times by 1 test
Evaluated by:
  • Self test
|| busy[nbuck]
busy[nbuck]Description
TRUEnever evaluated
FALSEevaluated 189187 times by 1 test
Evaluated by:
  • Self test
)
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
mpDescription
TRUEevaluated 337004 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24071 times by 1 test
Evaluated by:
  • Self test
&& mp != (union mhead *)((char *)mp1 + siz)
mp != (union m...r *)mp1 + siz)Description
TRUEevaluated 171888 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 165116 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
171888
165-
166 if (mp == 0
mp == 0Description
TRUEevaluated 24071 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 165116 times by 1 test
Evaluated by:
  • Self test
)
24071-165116
167 {-
168 busy[nbuck] = 0;-
169 return;
executed 24071 times by 1 test: return;
Executed by:
  • Self test
24071
170 }-
171-
172-
173-
174 if (mp2 != mp1
mp2 != mp1Description
TRUEevaluated 36969 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 128147 times by 1 test
Evaluated by:
  • Self test
&& (*(union
(*(union mhead...(mp2))) != mp1Description
TRUEnever evaluated
FALSEevaluated 36969 times by 1 test
Evaluated by:
  • Self test
mhead **) (sizeof (char *) + (char *) (mp2))) != mp1
(*(union mhead...(mp2))) != mp1Description
TRUEnever evaluated
FALSEevaluated 36969 times by 1 test
Evaluated by:
  • Self test
)
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
(*(union mhead...r *)mp1 + siz)Description
TRUEnever evaluated
FALSEevaluated 165116 times by 1 test
Evaluated by:
  • Self test
mhead **) (sizeof (char *) + (char *) (mp1))) != (union mhead *)((char *)mp1 + siz)
(*(union mhead...r *)mp1 + siz)Description
TRUEnever evaluated
FALSEevaluated 165116 times by 1 test
Evaluated by:
  • Self test
)
0-165116
184 {-
185 busy[nbuck] = 0;-
186 return;
never executed: return;
0
187 }-
188-
189-
190-
191 if (mp1 == nextf[nbuck]
mp1 == nextf[nbuck]Description
TRUEevaluated 128147 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 36969 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
128147
193 else-
194 (*(union
executed 36969 times by 1 test: (*(union mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp)));
Executed by:
  • Self test
mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp)));
executed 36969 times by 1 test: (*(union mhead **) (sizeof (char *) + (char *) (mp2))) = (*(union mhead **) (sizeof (char *) + (char *) (mp)));
Executed by:
  • Self test
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:
  • Self test
165116
208-
209-
210-
211-
212-
213static void-
214bsplit (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 = (
(maxbuck > 14)Description
TRUEevaluated 203279 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2975467 times by 1 test
Evaluated by:
  • Self test
maxbuck > 14)
(maxbuck > 14)Description
TRUEevaluated 203279 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2975467 times by 1 test
Evaluated by:
  • Self test
? maxbuck : 14;
203279-2975467
222-
223 if (nu >= 11
nu >= 11Description
TRUEevaluated 13786 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3164960 times by 1 test
Evaluated by:
  • Self test
)
13786-3164960
224 {-
225 for (nbuck = split_max; nbuck > nu
nbuck > nuDescription
TRUEevaluated 25847 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 13776 times by 1 test
Evaluated by:
  • Self test
; nbuck--)
13776-25847
226 {-
227 if (busy[nbuck]
busy[nbuck]Description
TRUEnever evaluated
FALSEevaluated 25847 times by 1 test
Evaluated by:
  • Self test
|| nextf[nbuck] == 0
nextf[nbuck] == 0Description
TRUEevaluated 25837 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test
)
0-25847
228 continue;
executed 25837 times by 1 test: continue;
Executed by:
  • Self test
25837
229 break;
executed 10 times by 1 test: break;
Executed by:
  • Self test
10
230 }-
231 }
executed 13786 times by 1 test: end of block
Executed by:
  • Self test
13786
232 else-
233 {-
234 for (nbuck = nu + 1; nbuck <= split_max
nbuck <= split_maxDescription
TRUEevaluated 6486574 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 329326 times by 1 test
Evaluated by:
  • Self test
; nbuck++)
329326-6486574
235 {-
236 if (busy[nbuck]
busy[nbuck]Description
TRUEnever evaluated
FALSEevaluated 6486574 times by 1 test
Evaluated by:
  • Self test
|| nextf[nbuck] == 0
nextf[nbuck] == 0Description
TRUEevaluated 3650940 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2835634 times by 1 test
Evaluated by:
  • Self test
)
0-6486574
237 continue;
executed 3650940 times by 1 test: continue;
Executed by:
  • Self test
3650940
238 break;
executed 2835634 times by 1 test: break;
Executed by:
  • Self test
2835634
239 }-
240 }
executed 3164960 times by 1 test: end of block
Executed by:
  • Self test
3164960
241-
242 if (nbuck > split_max
nbuck > split_maxDescription
TRUEevaluated 329326 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2849420 times by 1 test
Evaluated by:
  • Self test
|| nbuck <= nu
nbuck <= nuDescription
TRUEevaluated 13776 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2835644 times by 1 test
Evaluated by:
  • Self test
)
13776-2849420
243 return;
executed 343102 times by 1 test: return;
Executed by:
  • Self test
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 (--
--nblks <= 0Description
TRUEevaluated 2835644 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4839142 times by 1 test
Evaluated by:
  • Self test
nblks <= 0
--nblks <= 0Description
TRUEevaluated 2835644 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 4839142 times by 1 test
Evaluated by:
  • Self test
) break;
executed 2835644 times by 1 test: break;
Executed by:
  • Self test
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:
  • Self test
4839142
273 (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0;-
274}
executed 2835644 times by 1 test: end of block
Executed by:
  • Self test
2835644
275-
276-
277-
278static void-
279xsplit (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
nbuck >= 2Description
TRUEnever evaluated
FALSEnever evaluated
&& busy[nbuck]
busy[nbuck]Description
TRUEnever evaluated
FALSEnever evaluated
)
0
289 nbuck--;
never executed: nbuck--;
0
290 if (nbuck < 2
nbuck < 2Description
TRUEnever evaluated
FALSEnever evaluated
)
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 (--
--nblks <= 0Description
TRUEnever evaluated
FALSEnever evaluated
nblks <= 0
--nblks <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) break;
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-
319void-
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:
  • Self test
627432
335-
336void-
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:
  • Self test
627432
352-
353-
354-
355-
356static void-
357lesscore (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:
  • Self test
1722
373-
374-
375static void-
376morecore (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
interrupt_immediatelyDescription
TRUEnever evaluated
FALSEevaluated 3186477 times by 1 test
Evaluated by:
  • Self test
|| running_trap
running_trapDescription
TRUEevaluated 4703 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3181774 times by 1 test
Evaluated by:
  • Self test
|| signal_is_trapped (
signal_is_trapped ( 2 )Description
TRUEevaluated 494 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
0-3186477
391 2
signal_is_trapped ( 2 )Description
TRUEevaluated 494 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
494-3181280
392 )
signal_is_trapped ( 2 )Description
TRUEevaluated 494 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
|| signal_is_trapped (
signal_is_trapped ( 17 )Description
TRUEnever evaluated
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
0-3181280
393 17
signal_is_trapped ( 17 )Description
TRUEnever evaluated
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
0-3181280
394 )
signal_is_trapped ( 17 )Description
TRUEnever evaluated
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
5197
403-
404 siz = binsizes[(nu)];-
405-
406 if (siz < 0
siz < 0Description
TRUEnever evaluated
FALSEevaluated 3186477 times by 1 test
Evaluated by:
  • Self test
)
0-3186477
407 goto
never executed: goto morecore_done;
morecore_done;
never executed: goto morecore_done;
0
408-
409-
410 _mstats.nmorecore[nu]++;-
411-
412-
413-
414-
415 if (nu >= 2
nu >= 2Description
TRUEevaluated 3178746 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7731 times by 1 test
Evaluated by:
  • Self test
)
7731-3178746
416 {-
417 bsplit (nu);-
418 if (nextf[nu] != 0
nextf[nu] != 0Description
TRUEevaluated 2835644 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 343102 times by 1 test
Evaluated by:
  • Self test
)
343102-2835644
419 goto
executed 2835644 times by 1 test: goto morecore_done;
Executed by:
  • Self test
morecore_done;
executed 2835644 times by 1 test: goto morecore_done;
Executed by:
  • Self test
2835644
420 }
executed 343102 times by 1 test: end of block
Executed by:
  • Self test
343102
421-
422-
423-
424 if (nu >= 2
nu >= 2Description
TRUEevaluated 343102 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 7731 times by 1 test
Evaluated by:
  • Self test
&& nu < (pagebucket - 1)
nu < (pagebucket - 1)Description
TRUEevaluated 263543 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 79559 times by 1 test
Evaluated by:
  • Self test
&& busy[nu - 1] == 0
busy[nu - 1] == 0Description
TRUEevaluated 263543 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& nextf[nu - 1]
nextf[nu - 1]Description
TRUEevaluated 189187 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 74356 times by 1 test
Evaluated by:
  • Self test
)
0-343102
425 {-
426 bcoalesce (nu);-
427 if (nextf[nu] != 0
nextf[nu] != 0Description
TRUEevaluated 165116 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 24071 times by 1 test
Evaluated by:
  • Self test
)
24071-165116
428 goto
executed 165116 times by 1 test: goto morecore_done;
Executed by:
  • Self test
morecore_done;
executed 165116 times by 1 test: goto morecore_done;
Executed by:
  • Self test
165116
429 }
executed 24071 times by 1 test: end of block
Executed by:
  • Self test
24071
430-
431-
432-
433 if (siz <= pagesz
siz <= pageszDescription
TRUEevaluated 147809 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 37908 times by 1 test
Evaluated by:
  • Self test
)
37908-147809
434 {-
435 sbrk_amt = pagesz;-
436 nblks = sbrk_amt / siz;-
437 }
executed 147809 times by 1 test: end of block
Executed by:
  • Self test
147809
438 else-
439 {-
440-
441-
442-
443-
444-
445 sbrk_amt = siz & (pagesz - 1);-
446 if (sbrk_amt == 0
sbrk_amt == 0Description
TRUEevaluated 37908 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-37908
447 sbrk_amt = siz;
executed 37908 times by 1 test: sbrk_amt = siz;
Executed by:
  • Self test
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:
  • Self test
37908
452-
453-
454 _mstats.nsbrk++;-
455 _mstats.tsbrk += sbrk_amt;-
456-
457-
458 mp = (union mhead *) sbrk (sbrk_amt);-
459-
460-
461 if ((
(long)mp == -1Description
TRUEnever evaluated
FALSEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
long)mp == -1
(long)mp == -1Description
TRUEnever evaluated
FALSEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
)
0-185717
462 goto
never executed: goto morecore_done;
morecore_done;
never executed: goto morecore_done;
0
463-
464 memtop += sbrk_amt;-
465-
466-
467 if ((
(long)mp & 7Description
TRUEnever evaluated
FALSEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
long)mp & 7
(long)mp & 7Description
TRUEnever evaluated
FALSEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
)
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 (--
--nblks <= 0Description
TRUEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6130904 times by 1 test
Evaluated by:
  • Self test
nblks <= 0
--nblks <= 0Description
TRUEevaluated 185717 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 6130904 times by 1 test
Evaluated by:
  • Self test
) break;
executed 185717 times by 1 test: break;
Executed by:
  • Self test
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:
  • Self test
6130904
483 (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0;-
484-
485morecore_done:
code before this statement executed 185717 times by 1 test: morecore_done:
Executed by:
  • Self test
185717
486 if (blocked_sigs
blocked_sigsDescription
TRUEevaluated 5197 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 3181280 times by 1 test
Evaluated by:
  • Self test
)
5197-3181280
487 _malloc_unblock_signals (&set, &oset);
executed 5197 times by 1 test: _malloc_unblock_signals (&set, &oset);
Executed by:
  • Self test
5197
488}
executed 3186477 times by 1 test: end of block
Executed by:
  • Self test
3186477
489-
490static void-
491malloc_debug_dummy ()-
492{-
493 write (1, "malloc_debug_dummy\n", 19);-
494}
never executed: end of block
0
495-
496-
497-
498-
499static int-
500pagealign ()-
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
pagesz < 1024Description
TRUEnever evaluated
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
)
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
sbrk_needed < 0Description
TRUEnever evaluated
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
)
0-5432
518 sbrk_needed += pagesz;
never executed: sbrk_needed += pagesz;
0
519-
520-
521 if (sbrk_needed
sbrk_neededDescription
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5432
522 {-
523-
524 _mstats.nsbrk++;-
525 _mstats.tsbrk += sbrk_needed;-
526-
527 curbrk = sbrk (sbrk_needed);-
528 if ((
(long)curbrk == -1Description
TRUEnever evaluated
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
long)curbrk == -1
(long)curbrk == -1Description
TRUEnever evaluated
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
)
0-5432
529 return
never executed: return -1;
-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
nunits > 0Description
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
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 (--
--nunits <= 0Description
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 689864 times by 1 test
Evaluated by:
  • Self test
nunits <= 0
--nunits <= 0Description
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 689864 times by 1 test
Evaluated by:
  • Self test
) break;
executed 5432 times by 1 test: break;
Executed by:
  • Self test
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:
  • Self test
689864
553 (*(union mhead **) (sizeof (char *) + (char *) (mp))) = 0;-
554 }
executed 5432 times by 1 test: end of block
Executed by:
  • Self test
5432
555 }
executed 5432 times by 1 test: end of block
Executed by:
  • Self test
5432
556-
557-
558 for (nunits = 7; nunits < 30
nunits < 30Description
TRUEevaluated 16296 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
; nunits++)
0-16296
559 if (pagesz <= binsizes[(nunits)]
pagesz <= binsizes[(nunits)]Description
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 10864 times by 1 test
Evaluated by:
  • Self test
)
5432-10864
560 break;
executed 5432 times by 1 test: break;
Executed by:
  • Self test
5432
561 pagebucket = nunits;-
562-
563 return
executed 5432 times by 1 test: return 0;
Executed by:
  • Self test
0;
executed 5432 times by 1 test: return 0;
Executed by:
  • Self test
5432
564}-
565-
566static void *-
567internal_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
pagesz == 0Description
TRUEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
5432-Inf
582 if (pagealign () < 0
pagealign () < 0Description
TRUEnever evaluated
FALSEevaluated 5432 times by 1 test
Evaluated by:
  • Self test
)
0-5432
583 return
never executed: return ((void *) ((void *)0) );
((void *)
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 = (
(nbytes <= (pagesz >> 1))Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 57895586 times by 1 test
Evaluated by:
  • Self test
nbytes <= (pagesz >> 1))
(nbytes <= (pagesz >> 1))Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 57895586 times by 1 test
Evaluated by:
  • Self test
? 1 : pagebucket;
57895586-Inf
593 for ( ; nunits < 30
nunits < 30Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
; nunits++)
0-Inf
594 if (nbytes <= binsizes[(nunits)]
nbytes <= binsizes[(nunits)]Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
Inf
595 break;
executed 2147483647 times by 1 test: break;
Executed by:
  • Self test
Inf
596-
597-
598 if (nunits >= 30
nunits >= 30Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
0-Inf
599 return
never executed: return ((void *) ((void *)0) );
((void *)
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]
busy[nunits]Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) _mstats.nrecurse++;
never executed: _mstats.nrecurse++;
0-Inf
609-
610 while (busy[nunits]
busy[nunits]Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) nunits++;
never executed: nunits++;
0-Inf
611 busy[nunits] = 1;-
612-
613 if (nunits > maxbuck
nunits > maxbuckDescription
TRUEevaluated 27177 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
27177-Inf
614 maxbuck = nunits;
executed 27177 times by 1 test: maxbuck = nunits;
Executed by:
  • Self test
27177
615-
616-
617 if (nextf[nunits] == 0
nextf[nunits] == 0Description
TRUEevaluated 3186477 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
3186477-Inf
618 morecore (nunits);
executed 3186477 times by 1 test: morecore (nunits);
Executed by:
  • Self test
3186477
619-
620-
621 if ((
(p = nextf[nun...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
p = nextf[nunits]) ==
(p = nextf[nun...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
0-Inf
622 ((void *)0)
(p = nextf[nun...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
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)
p->minfo.mi_al... ((char) 0x54)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
|| p->minfo.mi_index != nunits
p->minfo.mi_index != nunitsDescription
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
nDescription
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 80 times by 1 test
Evaluated by:
  • Self test
)
80-Inf
656 do { if ((
(n) <= 32Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 399801898 times by 1 test
Evaluated by:
  • Self test
n) <= 32
(n) <= 32Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 399801898 times by 1 test
Evaluated by:
  • Self test
) { register char * mzp = ((char *)(p + 1)); unsigned long mctmp = (n); register long mcn; if (mctmp < 8
mctmp < 8Description
TRUEevaluated 1162447761 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1176959061 times by 1 test
Evaluated by:
  • Self test
) mcn = 0;
executed 1162447761 times by 1 test: mcn = 0;
Executed by:
  • Self test
else { mcn = (mctmp-1)/8; mctmp &= 7; }
executed 1176959061 times by 1 test: end of block
Executed by:
  • Self test
switch (mctmp) { case
executed 784811589 times by 1 test: case 0:
Executed by:
  • Self test
0:
executed 784811589 times by 1 test: case 0:
Executed by:
  • Self test
for(;;) { *mzp++ = 0xdf; case
executed 72406154 times by 1 test: case 7:
Executed by:
  • Self test
7:
executed 72406154 times by 1 test: case 7:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 7:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 103837580 times by 1 test: case 6:
Executed by:
  • Self test
6:
executed 103837580 times by 1 test: case 6:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 6:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 173970909 times by 1 test: case 5:
Executed by:
  • Self test
5:
executed 173970909 times by 1 test: case 5:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 5:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 121802483 times by 1 test: case 4:
Executed by:
  • Self test
4:
executed 121802483 times by 1 test: case 4:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 4:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 313187203 times by 1 test: case 3:
Executed by:
  • Self test
3:
executed 313187203 times by 1 test: case 3:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 3:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 601789411 times by 1 test: case 2:
Executed by:
  • Self test
2:
executed 601789411 times by 1 test: case 2:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 2:
Executed by:
  • Self test
*mzp++ = 0xdf; case
executed 167601493 times by 1 test: case 1:
Executed by:
  • Self test
1:
executed 167601493 times by 1 test: case 1:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 1:
Executed by:
  • Self test
*mzp++ = 0xdf; if(mcn <= 0
mcn <= 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) break;
executed 2147483647 times by 1 test: break;
Executed by:
  • Self test
mcn--; }
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
else memset (((char *)(p + 1)), (0xdf), (n));
executed 399801898 times by 1 test: memset (((char *)(p + 1)), (0xdf), (n));
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
while(0);
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
malloc_traceDescription
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x04) == 0
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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]
_malloc_trace_buckets[nunits]Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
malloc_registerDescription
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 81480 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x08) == 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
flags & 0x08) == 0
(flags & 0x08) == 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
Inf
675-
676-
677-
678 if (_malloc_nwatch > 0
_malloc_nwatch > 0Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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: return (void *) (p + 1);
Executed by:
  • Self test
(void *) (p + 1);
executed 2147483647 times by 1 test: return (void *) (p + 1);
Executed by:
  • Self test
Inf
683}-
684-
685static void-
686internal_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 ((
(ap = (char *)mem) == 0Description
TRUEevaluated 66190 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
ap = (char *)mem) == 0
(ap = (char *)mem) == 0Description
TRUEevaluated 66190 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
66190-Inf
699 return;
executed 66190 times by 1 test: return;
Executed by:
  • Self test
66190
700-
701 p = (union mhead *) ap - 1;-
702-
703 if (p->minfo.mi_alloc == ((char) 0xd6)
p->minfo.mi_al... ((char) 0xd6)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
malloc_traceDescription
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
|| malloc_register
malloc_registerDescription
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38024 times by 1 test
Evaluated by:
  • Self test
|| _malloc_nwatch > 0
_malloc_nwatch > 0Description
TRUEnever evaluated
FALSEevaluated 38024 times by 1 test
Evaluated by:
  • Self test
)
0-Inf
711 ubytes = p->minfo.mi_nbytes;
executed 2147483647 times by 1 test: ubytes = p->minfo.mi_nbytes;
Executed by:
  • Self test
Inf
712-
713-
714 if (p->minfo.mi_alloc != ((char) 0xf7)
p->minfo.mi_al... ((char) 0xf7)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
0-Inf
715 {-
716 if (p->minfo.mi_alloc == ((char) 0x54)
p->minfo.mi_al... ((char) 0x54)Description
TRUEnever evaluated
FALSEnever evaluated
)
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)
!(p->minfo.mi_...ic2 == 0x5555)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line);
never executed: xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line);
} while (0);
0-Inf
733-
734 nunits = p->minfo.mi_index;-
735 nbytes = (((p->minfo.mi_nbytes) + sizeof(union mhead) + 4 + 7) & ~7);-
736 if (((
((nbytes) <= b...nunits)]) == 0Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
nbytes) <= binsizes[(nunits)]) == 0
((nbytes) <= b...nunits)]) == 0Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
mg.i != p->minfo.mi_nbytesDescription
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
nunits >= 10Description
TRUEevaluated 57858500 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
&& ((
((char *)p + b...s)] == memtop)Description
TRUEevaluated 57336584 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 521916 times by 1 test
Evaluated by:
  • Self test
char *)p + binsizes[(nunits)] == memtop)
((char *)p + b...s)] == memtop)Description
TRUEevaluated 57336584 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 521916 times by 1 test
Evaluated by:
  • Self test
)
521916-Inf
758-
759 {-
760-
761-
762-
763-
764 if ((
(nunits >= 13)Description
TRUEevaluated 1698 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 57334886 times by 1 test
Evaluated by:
  • Self test
nunits >= 13)
(nunits >= 13)Description
TRUEevaluated 1698 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 57334886 times by 1 test
Evaluated by:
  • Self test
|| busy[nunits]
busy[nunits]Description
TRUEnever evaluated
FALSEevaluated 57334886 times by 1 test
Evaluated by:
  • Self test
|| nextf[nunits] != 0
nextf[nunits] != 0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 57334862 times by 1 test
Evaluated by:
  • Self test
)
0-57334886
765 {-
766 lesscore (nunits);-
767-
768 goto
executed 1722 times by 1 test: goto free_return;
Executed by:
  • Self test
free_return;
executed 1722 times by 1 test: goto free_return;
Executed by:
  • Self test
1722
769 }-
770 }
executed 57334862 times by 1 test: end of block
Executed by:
  • Self test
57334862
771-
772-
773 if (p->minfo.mi_nbytes
p->minfo.mi_nbytesDescription
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 80 times by 1 test
Evaluated by:
  • Self test
)
80-Inf
774 do { if ((
(p->minfo.mi_nbytes) <= 32Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 398923759 times by 1 test
Evaluated by:
  • Self test
p->minfo.mi_nbytes) <= 32
(p->minfo.mi_nbytes) <= 32Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 398923759 times by 1 test
Evaluated by:
  • Self test
) { register char * mzp = (mem); unsigned long mctmp = (p->minfo.mi_nbytes); register long mcn; if (mctmp < 8
mctmp < 8Description
TRUEevaluated 1160792681 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 1169118356 times by 1 test
Evaluated by:
  • Self test
) mcn = 0;
executed 1160792681 times by 1 test: mcn = 0;
Executed by:
  • Self test
else { mcn = (mctmp-1)/8; mctmp &= 7; }
executed 1169118356 times by 1 test: end of block
Executed by:
  • Self test
switch (mctmp) { case
executed 778061153 times by 1 test: case 0:
Executed by:
  • Self test
0:
executed 778061153 times by 1 test: case 0:
Executed by:
  • Self test
for(;;) { *mzp++ = 0xcf; case
executed 72168244 times by 1 test: case 7:
Executed by:
  • Self test
7:
executed 72168244 times by 1 test: case 7:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 7:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 103651051 times by 1 test: case 6:
Executed by:
  • Self test
6:
executed 103651051 times by 1 test: case 6:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 6:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 173376289 times by 1 test: case 5:
Executed by:
  • Self test
5:
executed 173376289 times by 1 test: case 5:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 5:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 121350200 times by 1 test: case 4:
Executed by:
  • Self test
4:
executed 121350200 times by 1 test: case 4:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 4:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 312755919 times by 1 test: case 3:
Executed by:
  • Self test
3:
executed 312755919 times by 1 test: case 3:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 3:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 601138706 times by 1 test: case 2:
Executed by:
  • Self test
2:
executed 601138706 times by 1 test: case 2:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 2:
Executed by:
  • Self test
*mzp++ = 0xcf; case
executed 167409475 times by 1 test: case 1:
Executed by:
  • Self test
1:
executed 167409475 times by 1 test: case 1:
Executed by:
  • Self test
code before this statement executed 2147483647 times by 1 test: case 1:
Executed by:
  • Self test
*mzp++ = 0xcf; if(mcn <= 0
mcn <= 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) break;
executed 2147483647 times by 1 test: break;
Executed by:
  • Self test
mcn--; }
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
else memset ((mem), (0xcf), (p->minfo.mi_nbytes));
executed 398923759 times by 1 test: memset ((mem), (0xcf), (p->minfo.mi_nbytes));
Executed by:
  • Self test
}
executed 2147483647 times by 1 test: end of block
Executed by:
  • Self test
while(0);
72168244-Inf
775-
776-
777 do { if (!(nunits < 30)
!(nunits < 30)Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
) xbotch((void *)0, 0x08, "nunits < 30", file, line);
never executed: xbotch((void *)0, 0x08, "nunits < 30", file, line);
} while (0);
0-Inf
778-
779 if (busy[nunits] == 1
busy[nunits] == 1Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
0-Inf
780 {-
781 xsplit (p, nunits);-
782 goto
never executed: goto free_return;
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-
793free_return:
code before this statement executed 2147483647 times by 1 test: free_return:
Executed by:
  • Self test
Inf
794 ;-
795-
796-
797 _mstats.nmalloc[nunits]--;-
798 _mstats.nfre++;-
799-
800-
801-
802 if (malloc_trace
malloc_traceDescription
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x04) == 0
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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]
_malloc_trace_buckets[nunits]Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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
malloc_registerDescription
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 38024 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x08) == 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 0x08) == 0
(flags & 0x08) == 0Description
TRUEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-Inf
810 mregister_free (mem, ubytes, file, line);
executed 2147483647 times by 1 test: mregister_free (mem, ubytes, file, line);
Executed by:
  • Self test
Inf
811-
812-
813-
814 if (_malloc_nwatch > 0
_malloc_nwatch > 0Description
TRUEnever evaluated
FALSEevaluated 2147483647 times by 1 test
Evaluated by:
  • Self test
)
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:
  • Self test
Inf
818-
819static void *-
820internal_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
n == 0Description
TRUEnever evaluated
FALSEevaluated 4729931 times by 1 test
Evaluated by:
  • Self test
)
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 ((
(p = (union mhead *) mem) == 0Description
TRUEevaluated 4635899 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
p = (union mhead *) mem) == 0
(p = (union mhead *) mem) == 0Description
TRUEevaluated 4635899 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
)
94032-4635899
845 return
executed 4635899 times by 1 test: return internal_malloc (n, file, line, 0x02);
Executed by:
  • Self test
internal_malloc (n, file, line, 0x02);
executed 4635899 times by 1 test: return internal_malloc (n, file, line, 0x02);
Executed by:
  • Self test
4635899
846-
847 p--;-
848 nunits = p->minfo.mi_index;-
849 do { if (!(nunits < 30)
!(nunits < 30)Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
) xbotch((void *)0, 0x08, "nunits < 30", file, line);
never executed: xbotch((void *)0, 0x08, "nunits < 30", file, line);
} while (0);
0-94032
850-
851 if (p->minfo.mi_alloc != ((char) 0xf7)
p->minfo.mi_al... ((char) 0xf7)Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
)
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)
!(p->minfo.mi_...ic2 == 0x5555)Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
) xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line);
never executed: xbotch((void *)0, 0x08, "p->minfo.mi_magic2 == 0x5555", file, line);
} while (0);
0-94032
860 nbytes = (((p->minfo.mi_nbytes) + sizeof(union mhead) + 4 + 7) & ~7);-
861 if (((
((nbytes) <= b...nunits)]) == 0Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
nbytes) <= binsizes[(nunits)]) == 0
((nbytes) <= b...nunits)]) == 0Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
)
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
mg.i != p->minfo.mi_nbytesDescription
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
)
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
_malloc_nwatch > 0Description
TRUEnever evaluated
FALSEevaluated 94032 times by 1 test
Evaluated by:
  • Self test
)
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 += (
(n < tocopy)Description
TRUEevaluated 101 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 93931 times by 1 test
Evaluated by:
  • Self test
n < tocopy)
(n < tocopy)Description
TRUEevaluated 101 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 93931 times by 1 test
Evaluated by:
  • Self test
? 0 : n - tocopy;
101-93931
885-
886-
887-
888 if (n == p->minfo.mi_nbytes
n == p->minfo.mi_nbytesDescription
TRUEevaluated 167 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 93865 times by 1 test
Evaluated by:
  • Self test
)
167-93865
889 return
executed 167 times by 1 test: return mem;
Executed by:
  • Self test
mem;
executed 167 times by 1 test: return mem;
Executed by:
  • Self test
167
890-
891-
892 nbytes = (((n) + sizeof(union mhead) + 4 + 7) & ~7);-
893-
894-
895 if ((((
((nbytes) > bi...s[(nunits)-1])Description
TRUEevaluated 93765 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test
nbytes) > binsizes[(nunits)-1])
((nbytes) > bi...s[(nunits)-1])Description
TRUEevaluated 93765 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test
&& ((
((nbytes) <= b...zes[(nunits)])Description
TRUEevaluated 58815 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34950 times by 1 test
Evaluated by:
  • Self test
nbytes) <= binsizes[(nunits)])
((nbytes) <= b...zes[(nunits)])Description
TRUEevaluated 58815 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34950 times by 1 test
Evaluated by:
  • Self test
) || (((
((nbytes) > bi...(nunits-1)-1])Description
TRUEevaluated 34797 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 253 times by 1 test
Evaluated by:
  • Self test
nbytes) > binsizes[(nunits-1)-1])
((nbytes) > bi...(nunits-1)-1])Description
TRUEevaluated 34797 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 253 times by 1 test
Evaluated by:
  • Self test
&& ((
((nbytes) <= b...s[(nunits-1)])Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34793 times by 1 test
Evaluated by:
  • Self test
nbytes) <= binsizes[(nunits-1)])
((nbytes) <= b...s[(nunits-1)])Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34793 times by 1 test
Evaluated by:
  • Self test
))
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: return mem;
Executed by:
  • Self test
mem;
executed 58819 times by 1 test: return mem;
Executed by:
  • Self test
58819
911 }-
912-
913 if (n < tocopy
n < tocopyDescription
TRUEevaluated 96 times by 1 test
Evaluated by:
  • Self test
FALSEevaluated 34950 times by 1 test
Evaluated by:
  • Self test
)
96-34950
914 tocopy = n;
executed 96 times by 1 test: tocopy = n;
Executed by:
  • Self test
96
915-
916-
917 _mstats.nrcopy++;-
918-
919-
920 if ((
(m = internal_...04|0x08)) == 0Description
TRUEnever evaluated
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
m = internal_malloc (n, file, line, 0x02|0x04|0x08)) == 0
(m = internal_...04|0x08)) == 0Description
TRUEnever evaluated
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
)
0-35046
921 return
never executed: return 0;
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
malloc_traceDescription
TRUEnever evaluated
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
&& (
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
flags & 0x04) == 0
(flags & 0x04) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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]
_malloc_trace_buckets[nunits]Description
TRUEnever evaluated
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
)
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
malloc_registerDescription
TRUEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
&& (
(flags & 0x08) == 0Description
TRUEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
flags & 0x08) == 0
(flags & 0x08) == 0Description
TRUEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
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:
  • Self test
35046
935-
936-
937-
938 if (_malloc_nwatch > 0
_malloc_nwatch > 0Description
TRUEnever evaluated
FALSEevaluated 35046 times by 1 test
Evaluated by:
  • Self test
)
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: return m;
Executed by:
  • Self test
m;
executed 35046 times by 1 test: return m;
Executed by:
  • Self test
35046
943}-
944-
945static void *-
946internal_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
ptr == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
959 return
never executed: return 0;
0;
never executed: return 0;
0
960-
961 if (((
((long) ptr & ...ent - 1)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
long) ptr & (alignment - 1)) == 0
((long) ptr & ...ent - 1)) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
962 return
never executed: return ptr;
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: return aligned;
aligned;
never executed: return aligned;
0
977}-
978-
979int-
980posix_memalign (memptr, alignment, size)-
981 void **memptr;-
982 size_t alignment, size;-
983{-
984 void *mem;-
985-
986-
987 if ((
(alignment % s...(void *) != 0)Description
TRUEnever evaluated
FALSEnever evaluated
alignment % sizeof (void *) != 0)
(alignment % s...(void *) != 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| alignment == 0
alignment == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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 (((((
((((alignment)...t)) == 0) == 0Description
TRUEnever evaluated
FALSEnever evaluated
alignment) - 1) & (alignment)) == 0) == 0
((((alignment)...t)) == 0) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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
mem != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
998 {-
999 *memptr = mem;-
1000 return
never executed: return 0;
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-
1007size_t-
1008malloc_usable_size (mem)-
1009 void *mem;-
1010{-
1011 register union mhead *p;-
1012 register char *ap;-
1013 register int maxbytes;-
1014-
1015-
1016 if ((
(ap = (char *)mem) == 0Description
TRUEnever evaluated
FALSEnever evaluated
ap = (char *)mem) == 0
(ap = (char *)mem) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1017 return
never executed: return 0;
0;
never executed: return 0;
0
1018-
1019-
1020 p = (union mhead *) ap - 1;-
1021 if (p->minfo.mi_alloc == ((char) 0xd6)
p->minfo.mi_al... ((char) 0xd6)Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return (maxbytes);
(maxbytes);
never executed: return (maxbytes);
0
1034}-
1035-
1036-
1037-
1038-
1039static void *-
1040internal_valloc (size, file, line, flags)-
1041 size_t size;-
1042 const char *file;-
1043 int line, flags;-
1044{-
1045 return
never executed: return internal_memalign (getpagesize (), size, file, line, flags|0x02);
internal_memalign (getpagesize (), size, file, line, flags|0x02);
never executed: return internal_memalign (getpagesize (), size, file, line, flags|0x02);
0
1046}-
1047-
1048-
1049-
1050static void *-
1051internal_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
resultDescription
TRUEevaluated 5936 times by 1 test
Evaluated by:
  • Self test
FALSEnever evaluated
)
0-5936
1062 memset (result, 0, total);
executed 5936 times by 1 test: memset (result, 0, total);
Executed by:
  • Self test
5936
1063 return
executed 5936 times by 1 test: return result;
Executed by:
  • Self test
result;
executed 5936 times by 1 test: return result;
Executed by:
  • Self test
5936
1064}-
1065-
1066static void-
1067internal_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-
1077int-
1078malloc_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
pDescription
TRUEnever evaluated
FALSEnever evaluated
; p = (*(union mhead **) (sizeof (char *) + (char *) (p))))
0
1086 nfree++;
never executed: nfree++;
0
1087-
1088 return
never executed: return nfree;
nfree;
never executed: return nfree;
0
1089}-
1090-
1091-
1092-
1093void *-
1094sh_malloc (bytes, file, line)-
1095 size_t bytes;-
1096 const char *file;-
1097 int line;-
1098{-
1099 return
executed 2147483647 times by 1 test: return internal_malloc (bytes, file, line, 0x01);
Executed by:
  • Self test
internal_malloc (bytes, file, line, 0x01);
executed 2147483647 times by 1 test: return internal_malloc (bytes, file, line, 0x01);
Executed by:
  • Self test
Inf
1100}-
1101-
1102void *-
1103sh_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: return internal_realloc (ptr, size, file, line, 0x01);
Executed by:
  • Self test
internal_realloc (ptr, size, file, line, 0x01);
executed 92882 times by 1 test: return internal_realloc (ptr, size, file, line, 0x01);
Executed by:
  • Self test
92882
1110}-
1111-
1112void-
1113sh_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:
  • Self test
Inf
1120-
1121void *-
1122sh_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: return internal_memalign (alignment, size, file, line, 0x01);
internal_memalign (alignment, size, file, line, 0x01);
never executed: return internal_memalign (alignment, size, file, line, 0x01);
0
1129}-
1130-
1131-
1132void *-
1133sh_calloc (n, s, file, line)-
1134 size_t n, s;-
1135 const char *file;-
1136 int line;-
1137{-
1138 return
never executed: return internal_calloc (n, s, file, line, 0x01);
internal_calloc (n, s, file, line, 0x01);
never executed: return internal_calloc (n, s, file, line, 0x01);
0
1139}-
1140-
1141void-
1142sh_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-
1152void *-
1153sh_valloc (size, file, line)-
1154 size_t size;-
1155 const char *file;-
1156 int line;-
1157{-
1158 return
never executed: return internal_valloc (size, file, line, 0x01);
internal_valloc (size, file, line, 0x01);
never executed: return internal_valloc (size, file, line, 0x01);
0
1159}-
1160-
1161-
1162-
1163-
1164-
1165-
1166void *-
1167malloc (size)-
1168 size_t size;-
1169{-
1170 return
executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
internal_malloc (size, (char *)
executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
116973081
1171 ((void *)0)
executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
116973081
1172 , 0, 0);
executed 116973081 times by 1 test: return internal_malloc (size, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
116973081
1173}-
1174-
1175void *-
1176realloc (mem, nbytes)-
1177 void * mem;-
1178 size_t nbytes;-
1179{-
1180 return
executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
internal_realloc (mem, nbytes, (char *)
executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
4637049
1181 ((void *)0)
executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
4637049
1182 , 0, 0);
executed 4637049 times by 1 test: return internal_realloc (mem, nbytes, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
4637049
1183}-
1184-
1185void-
1186free (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:
  • Self test
115886356
1193-
1194void *-
1195memalign (alignment, size)-
1196 size_t alignment;-
1197 size_t size;-
1198{-
1199 return
never executed: return internal_memalign (alignment, size, (char *) ((void *)0) , 0, 0);
internal_memalign (alignment, size, (char *)
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-
1205void *-
1206valloc (size)-
1207 size_t size;-
1208{-
1209 return
never executed: return internal_valloc (size, (char *) ((void *)0) , 0, 0);
internal_valloc (size, (char *)
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-
1216void *-
1217calloc (n, s)-
1218 size_t n, s;-
1219{-
1220 return
executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
internal_calloc (n, s, (char *)
executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
5936
1221 ((void *)0)
executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
5936
1222 , 0, 0);
executed 5936 times by 1 test: return internal_calloc (n, s, (char *) ((void *)0) , 0, 0);
Executed by:
  • Self test
5936
1223}-
1224-
1225void-
1226cfree (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 codePreprocessed file

Generated by Squish Coco 4.1.2