diff --git a/src/mod/event_handlers/mod_rayo/nlsml.c b/src/mod/event_handlers/mod_rayo/nlsml.c index 732687900d..61730127c4 100644 --- a/src/mod/event_handlers/mod_rayo/nlsml.c +++ b/src/mod/event_handlers/mod_rayo/nlsml.c @@ -356,6 +356,12 @@ enum nlsml_match_type nlsml_parse(const char *nlsml_result, const char *uuid) } end: + while (parser.cur) { + struct nlsml_node *node = parser.cur; + parser.cur = node->parent; + free(node); + } + if ( p ) { iks_parser_delete(p); } diff --git a/src/mod/event_handlers/mod_rayo/test/test_iks.c b/src/mod/event_handlers/mod_rayo/test/test_iks.c index 02a17303d9..29b424afc0 100644 --- a/src/mod/event_handlers/mod_rayo/test/test_iks.c +++ b/src/mod/event_handlers/mod_rayo/test/test_iks.c @@ -164,15 +164,27 @@ FST_TEST_END() FST_TEST_BEGIN(dialback_key) { - fst_check_string_equals("37c69b1cf07a3f67c04a5ef5902fa5114f2c76fe4a2686482ba5b89323075643", iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("", "xmpp.example.com", "example.org", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "", "example.org", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", "")); - fst_check(NULL == iks_server_dialback_key(NULL, "xmpp.example.com", "example.org", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", NULL, "example.org", "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", NULL, "D60000229F")); - fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", NULL)); + char *dialback_key; + + dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", "D60000229F"); + fst_check_string_equals("37c69b1cf07a3f67c04a5ef5902fa5114f2c76fe4a2686482ba5b89323075643", dialback_key); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("", "xmpp.example.com", "example.org", "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "", "example.org", "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "", "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", ""))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key(NULL, "xmpp.example.com", "example.org", "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", NULL, "example.org", "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", NULL, "D60000229F"))); + switch_safe_free(dialback_key); + fst_check(NULL == (dialback_key = iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", NULL))); + switch_safe_free(dialback_key); } FST_TEST_END() diff --git a/src/mod/event_handlers/mod_rayo/test/test_nlsml.c b/src/mod/event_handlers/mod_rayo/test/test_nlsml.c index df5948f05a..7319a04f4c 100644 --- a/src/mod/event_handlers/mod_rayo/test/test_nlsml.c +++ b/src/mod/event_handlers/mod_rayo/test/test_nlsml.c @@ -301,6 +301,7 @@ FST_TEST_BEGIN(create_dtmf_match) result_str = iks_string(NULL, result); fst_check_string_equals(nlsml_dtmf_result, result_str); iks_free(result_str); + iks_delete(result); } FST_TEST_END() @@ -316,6 +317,7 @@ FST_TEST_BEGIN(create_dtmf_instance) result_str = iks_string(NULL, result); fst_check_string_equals(nlsml_dtmf_instance_result, result_str); iks_free(result_str); + iks_delete(result); } FST_TEST_END() @@ -325,8 +327,13 @@ FST_TEST_END() FST_TEST_BEGIN(normalize) { iks *result = nlsml_normalize(nlsml_good); + char *result_str; + fst_requires(result); - fst_check_string_equals(nlsml_good_normalized, iks_string(NULL, result)); + result_str = iks_string(NULL, result); + fst_check_string_equals(nlsml_good_normalized, result_str); + iks_free(result_str); + iks_delete(result); } FST_TEST_END() diff --git a/src/mod/event_handlers/mod_rayo/test/test_srgs.c b/src/mod/event_handlers/mod_rayo/test/test_srgs.c index 97284639bb..9bd6fc1eb5 100644 --- a/src/mod/event_handlers/mod_rayo/test/test_srgs.c +++ b/src/mod/event_handlers/mod_rayo/test/test_srgs.c @@ -1200,6 +1200,7 @@ FST_TEST_BEGIN(repeat_item_range_ambiguous_grammar) fst_check(SMT_MATCH == srgs_grammar_match(grammar, "1", &interpretation)); fst_check(SMT_MATCH == srgs_grammar_match(grammar, "12", &interpretation)); fst_check(SMT_MATCH_END == srgs_grammar_match(grammar, "123", &interpretation)); + srgs_parser_destroy(parser); } FST_TEST_END() @@ -1217,6 +1218,7 @@ FST_TEST_BEGIN(repeat_item_range_optional_pound_grammar) fst_check(SMT_MATCH == srgs_grammar_match(grammar, "12", &interpretation)); fst_check(SMT_MATCH_END == srgs_grammar_match(grammar, "12#", &interpretation)); fst_check(SMT_MATCH_END == srgs_grammar_match(grammar, "123", &interpretation)); + srgs_parser_destroy(parser); } FST_TEST_END() @@ -1253,6 +1255,7 @@ FST_TEST_BEGIN(w3c_example_grammar) fst_requires((grammar = srgs_parse(parser, w3c_example_grammar))); fst_check(srgs_grammar_to_jsgf(grammar)); + srgs_parser_destroy(parser); } FST_TEST_END() @@ -1266,6 +1269,7 @@ FST_TEST_BEGIN(metadata_grammar) fst_requires((grammar = srgs_parse(parser, metadata_grammar))); fst_check(srgs_grammar_to_jsgf(grammar)); + srgs_parser_destroy(parser); } FST_TEST_END()