Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
 scripts/coccinelle/g_new.cocci | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/coccinelle/g_new.cocci b/scripts/coccinelle/g_new.cocci
index 9643ce3f23..42ab166d04 100644
--- a/scripts/coccinelle/g_new.cocci
+++ b/scripts/coccinelle/g_new.cocci
@@ -173,6 +173,17 @@ expression s, e;
   ... when != p
   *p = e;
 
+// g_strfreev()
+@@
+identifier p, a;
+@@
+-   for (p = a; *p; p++) {
+-       g_free(*p);
+-   }
+    ... when != a
+-    g_free(a);
++    g_strfreev(a);
+
 ////////////////////////////////////////
 //
 // last transformations: cleanups
-- 
2.14.2


Reply via email to