diff --git a/main/Makefile b/main/Makefile
index ace2c813ba30767e7ce9aefe40996670e82b7ed1..b91be6cdc668259a91447988cbd2bdb34090e6f6 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -115,6 +115,8 @@ ast_expr2.c ast_expr2.h:
 
 ast_expr2f.c:
 	flex -o $@ --full ast_expr2.fl
+	sed 's@free( (char \*) ptr );@if(ptr) free( (char *) ptr );@' ast_expr2f.c > zz
+	mv zz ast_expr2f.c
 
 testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h
 	$(CC) -g -c -Iinclude -DSTANDALONE ast_expr2f.c