Code

frontend: Added destructors for dynamically allocated objects in the parser.
authorSebastian Harl <sh@tokkee.org>
Fri, 25 Apr 2014 22:14:37 +0000 (00:14 +0200)
committerSebastian Harl <sh@tokkee.org>
Fri, 25 Apr 2014 22:14:37 +0000 (00:14 +0200)
This will make sure that the memory is freed in case of parse errors.

src/frontend/grammar.y

index 26c8c1b046ddaa8df0af9c66dd2d2588a842a972..abab594b53a58ee0ddf440ceced7d2a5357b6883 100644 (file)
@@ -104,6 +104,9 @@ sdb_fe_yyerror(YYLTYPE *lval, sdb_fe_yyscan_t scanner, const char *msg);
 %type <m> matcher
        compare_matcher
 
+%destructor { free($$); } <str>
+%destructor { sdb_object_deref(SDB_OBJ($$)); } <node> <m>
+
 %%
 
 statements: