blob: 6472e762f0cfa68b586cd5cf7d6e9d839aebb857 (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* A malloced pointer that's written to a global pointer shouldn't be
reported as leaking, even if an unknown function has been called
(PR analyzer/98575). */
void **g;
extern void unknown_fn (void);
/* Without a call to unknown_fn. */
int test_1 (void)
{
void *p;
p = __builtin_malloc(1024);
*g = p;
return 0;
}
/* With a call to unknown_fn in various places. */
int test_2 (void)
{
void *p;
unknown_fn ();
p = __builtin_malloc(1024);
*g = p;
return 0;
}
int test_3 (void)
{
void *p;
p = __builtin_malloc(1024);
unknown_fn ();
*g = p;
return 0;
}
int test_4 (void)
{
void *p;
p = __builtin_malloc(1024);
*g = p;
unknown_fn ();
return 0;
}
|