2018-10-04 18:14:54 +02:00
|
|
|
// Bug: free uninitialized pointer
|
|
|
|
// Fix: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=28960d79cca262ac6b974f339697b299a1e28fef
|
2018-10-04 18:07:11 +02:00
|
|
|
|
|
|
|
void *malloc(unsigned long);
|
|
|
|
void free(void *);
|
|
|
|
|
|
|
|
struct comment {
|
2018-10-04 18:14:54 +02:00
|
|
|
int *data;
|
2018-10-04 18:07:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct table {
|
2018-10-04 18:14:54 +02:00
|
|
|
struct comment *com;
|
2018-10-04 18:07:11 +02:00
|
|
|
};
|
|
|
|
|
2018-10-04 18:14:54 +02:00
|
|
|
void destroy_table(struct table *comment_table)
|
2018-10-04 18:07:11 +02:00
|
|
|
{
|
2018-10-04 18:14:54 +02:00
|
|
|
free(comment_table->com->data);
|
|
|
|
free(comment_table->com);
|
|
|
|
free(comment_table);
|
2018-10-04 18:07:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void f()
|
|
|
|
{
|
2018-10-04 18:14:54 +02:00
|
|
|
struct table *comment_table = (struct table *)malloc(sizeof(struct table));
|
2018-10-04 18:07:11 +02:00
|
|
|
struct comment *comment_rec = (struct comment *)malloc(sizeof(struct comment));
|
2018-10-04 18:14:54 +02:00
|
|
|
comment_table->com = comment_rec;
|
|
|
|
destroy_table(comment_table);
|
2018-10-04 18:07:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|