summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7ab700c)
raw | patch | inline | side by side (parent: 7ab700c)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 6 Apr 2014 12:04:48 +0000 (14:04 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 6 Apr 2014 12:04:48 +0000 (14:04 +0200) |
src/frontend/connection-private.h | patch | blob | history | |
src/frontend/grammar.y | patch | blob | history | |
src/frontend/parser.c | patch | blob | history |
index f2d85f2ccdfd177e461032421a90eb181f870fdc..574049e3dde05b42d1dc1e0dd326242d45ff43bc 100644 (file)
free(CONN_FETCH(obj)->name);
} /* conn_fetch_destroy */
+static void __attribute__((unused))
+conn_matcher_destroy(sdb_object_t *obj)
+{
+ if (CONN_MATCHER(obj)->matcher)
+ sdb_object_deref(SDB_OBJ(CONN_MATCHER(obj)->matcher));
+} /* conn_matcher_destroy */
+
static void __attribute__((unused))
conn_lookup_destroy(sdb_object_t *obj)
{
if (CONN_LOOKUP(obj)->matcher)
sdb_object_deref(SDB_OBJ(CONN_LOOKUP(obj)->matcher));
-} /* conn_fetch_destroy */
+} /* conn_lookup_destroy */
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y
index fd268baf3a9c6ce5126891c9ff6edbcc8af16e4f..abc51656934edcffc8c6f32ddf7320f985541d77 100644 (file)
--- a/src/frontend/grammar.y
+++ b/src/frontend/grammar.y
sdb_fe_yyerror(&yylloc, scanner,
YY_("syntax error, unexpected statement, "
"expecting expression"));
+ sdb_object_deref(SDB_OBJ($3));
YYABORT;
}
sdb_fe_yyerror(&yylloc, scanner,
YY_("syntax error, unexpected statement, "
"expecting expression"));
+ sdb_object_deref(SDB_OBJ($1));
YYABORT;
}
sdb_fe_yyerror(&yylloc, scanner,
YY_("syntax error, unexpected expression, "
"expecting statement"));
+ sdb_object_deref(SDB_OBJ($1));
YYABORT;
}
snprintf(errmsg, sizeof(errmsg),
YY_("unknown table %s"), $2);
sdb_fe_yyerror(&yylloc, scanner, errmsg);
+ free($2); $2 = NULL;
+ sdb_object_deref(SDB_OBJ($4));
YYABORT;
}
YYABORT;
}
- $$ = SDB_CONN_NODE(sdb_object_create_T(/* name = */ NULL,
- conn_node_matcher_t));
+ $$ = SDB_CONN_NODE(sdb_object_create_dT(/* name = */ NULL,
+ conn_node_matcher_t, conn_matcher_destroy));
$$->cmd = CONNECTION_EXPR;
if ((M(m)->type == MATCHER_HOST)
snprintf(errbuf, sizeof(errbuf),
YY_("syntax error, unexpected matcher type %d"),
M(m)->type);
+ sdb_object_deref(SDB_OBJ($$));
sdb_fe_yyerror(&yylloc, scanner, errbuf);
YYABORT;
}
diff --git a/src/frontend/parser.c b/src/frontend/parser.c
index 6504a66ea7a408b00522ab3ae94639f52e484df0..76382d34b099756b09348e0afa67ab013a9ab7ca 100644 (file)
--- a/src/frontend/parser.c
+++ b/src/frontend/parser.c
else
m = NULL;
+ CONN_MATCHER(node)->matcher = NULL;
sdb_llist_destroy(yyextra.parsetree);
sdb_object_deref(SDB_OBJ(node));
return m;