Skip to content

Commit 0078a75

Browse files
committed
Merge branch 'rs/cocci-check-free-only-null'
A new coccinelle rule that catches a check of !pointer before the pointer is free(3)d, which most likely is a bug. * rs/cocci-check-free-only-null: cocci: detect useless free(3) calls
2 parents 5a98255 + ec6cd14 commit 0078a75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

contrib/coccinelle/free.cocci

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ expression E;
33
@@
44
- if (E)
55
free(E);
6+
7+
@@
8+
expression E;
9+
@@
10+
- if (!E)
11+
free(E);

0 commit comments

Comments
 (0)