cppcheck/cve-test-suite/cve-2018-6836.c

29 lines
421 B
C
Raw Normal View History

2018-10-04 18:07:11 +02:00
void *malloc(unsigned long);
void free(void *);
struct comment {
int *p;
};
struct table {
struct comment *p;
};
void delete_table(struct table *t)
{
free(t->p->p);
free(t->p);
free(t);
}
void f()
{
struct table *t = (struct table *)malloc(sizeof(struct table));
struct comment *comment_rec = (struct comment *)malloc(sizeof(struct comment));
t->p = comment_rec;
delete_table(t);
}