git/contrib/coccinelle/free.cocci
René Scharfe ec6cd14c7a cocci: detect useless free(3) calls
Add a semantic patch for removing checks that cause free(3) to only be
called with a NULL pointer, as that must be a programming mistake.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-11 11:29:12 -08:00

12 lines
82 B
Plaintext

@@
expression E;
@@
- if (E)
free(E);
@@
expression E;
@@
- if (!E)
free(E);