Bug Summary

File:test.c
Location:line 19, column 5
Description:Use of memory after it is freed

Annotated Source Code

1/* Clang analyser use after free false positive test created by Barry Davis,
2 Stormagic. */
3#include <stdlib.h>
4
5struct list
6{
7 void *thing;
8 struct list *next;
9};
10
11struct list *
12fool_clang(struct list *item)
13{
14 struct list *next = item->next;
15 if (next)
1
Assuming 'next' is non-null
2
Taking true branch
16 {
17 *item = *next;
18 free(next);
3
Memory is released
19 return item->next;
4
Use of memory after it is freed
20 }
21
22 return item;
23}