blob: 5fc5b66dc76c131202a117658bd26d562b936d90 [file] [log] [blame]
/* Use of function pointer inside freed structure. */
#include <stdlib.h>
#include <stdio.h>
typedef struct
{
int value;
void (*(*f))(void);
} func_container;
void func()
{
printf("function\n");
}
int main()
{
func_container *c = malloc(sizeof(func_container));
c->f = malloc(sizeof(void (*)(void)));
*c->f = func;
free(c);
(*c->f)();
free(c->f);
return 0;
}