diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index 5bcb1e2a77..cd900cf880 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -207,7 +207,13 @@ YYPRINTF(const char *format, ...) g_list_append ((graph)->ctx->missing_elements, g_strdup (name)); \ } } G_STMT_END -#define GST_BIN_MAKE(res, type, chainval, assign, free_string) \ +static void +no_free (gconstpointer foo) +{ + /* do nothing */ +} + +#define GST_BIN_MAKE(res, type, chainval, assign, type_string_free_func) \ G_STMT_START { \ chain_t *chain = chainval; \ GSList *walk; \ @@ -218,8 +224,7 @@ G_STMT_START { \ g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \ g_slist_free (assign); \ gst_object_unref (bin); \ - if (free_string) \ - gst_parse_strfree (type); /* Need to clean up the string */ \ + type_string_free_func (type); /* Need to clean up the string */ \ YYERROR; \ } else if (!bin) { \ ADD_MISSING_ELEMENT(graph, type); \ @@ -665,14 +670,14 @@ element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL); assignments: /* NOP */ { $$ = NULL; } | assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); } ; -bin: '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, FALSE); } - | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2, TRUE); +bin: '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2, no_free); } + | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2, gst_parse_strfree); gst_parse_strfree ($1); } - | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE); + | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree); gst_parse_strfree ($1); } - | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2, TRUE); + | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2, gst_parse_strfree); gst_parse_strfree ($1); } ;