blob: ae196d75b935d28016cf9a0a9fbf7b700e597478 (
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
|
/* Reduced from haproxy-2.7.1's cfgparse.c. */
typedef __SIZE_TYPE__ size_t;
extern void*
calloc(size_t __nmemb, size_t __size)
__attribute__((__nothrow__, __leaf__))
__attribute__((__malloc__)) __attribute__((__alloc_size__(1, 2)));
struct list
{
struct list* n;
struct list* p;
};
struct cfg_postparser
{
struct list list;
char* name;
int (*func)();
};
extern struct list postparsers;
int
cfg_register_postparser(char* name, int (*func)())
{
struct cfg_postparser* cp;
cp = (struct cfg_postparser *) calloc(1, sizeof(*cp));
if (!cp) {
/* [...snip...] */
return 0;
}
cp->name = name;
cp->func = func;
({
(&cp->list)->p = (&postparsers)->p;
(&cp->list)->p->n = (&postparsers)->p = (&cp->list);
(&cp->list)->n = (&postparsers);
(&cp->list);
});
return 1; /* { dg-bogus "leak of 'cp'" } */
}
|