mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-18 14:55:58 +00:00
CID: 1211950 fix memory leak of iksparser in function nlsml_parse in mod_rayo
This commit is contained in:
parent
ad327dffc8
commit
2a50bbba68
@ -325,29 +325,37 @@ static int cdata_hook(void *user_data, char *data, size_t len)
|
|||||||
enum nlsml_match_type nlsml_parse(const char *result, const char *uuid)
|
enum nlsml_match_type nlsml_parse(const char *result, const char *uuid)
|
||||||
{
|
{
|
||||||
struct nlsml_parser parser = { 0 };
|
struct nlsml_parser parser = { 0 };
|
||||||
|
int result = NMT_BAD_XML;
|
||||||
|
iksparser *p = NULL;
|
||||||
parser.uuid = uuid;
|
parser.uuid = uuid;
|
||||||
|
|
||||||
if (!zstr(result)) {
|
if (!zstr(result)) {
|
||||||
iksparser *p = iks_sax_new(&parser, tag_hook, cdata_hook);
|
p = iks_sax_new(&parser, tag_hook, cdata_hook);
|
||||||
if (iks_parse(p, result, 0, 1) == IKS_OK) {
|
if (iks_parse(p, result, 0, 1) == IKS_OK) {
|
||||||
/* check result */
|
/* check result */
|
||||||
if (parser.match) {
|
if (parser.match) {
|
||||||
return NMT_MATCH;
|
result = NMT_MATCH;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
if (parser.nomatch) {
|
if (parser.nomatch) {
|
||||||
return NMT_NOMATCH;
|
result = NMT_NOMATCH;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
if (parser.noinput) {
|
if (parser.noinput) {
|
||||||
return NMT_NOINPUT;
|
result = NMT_NOINPUT;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "NLSML result does not have match/noinput/nomatch!\n");
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "NLSML result does not have match/noinput/nomatch!\n");
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "Failed to parse NLSML!\n");
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "Failed to parse NLSML!\n");
|
||||||
}
|
}
|
||||||
iks_parser_delete(p);
|
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "Missing NLSML result\n");
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser.uuid), SWITCH_LOG_INFO, "Missing NLSML result\n");
|
||||||
}
|
}
|
||||||
return NMT_BAD_XML;
|
end:
|
||||||
|
if ( p )
|
||||||
|
iks_parser_delete(p);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NLSML_NS "http://www.ietf.org/xml/ns/mrcpv2"
|
#define NLSML_NS "http://www.ietf.org/xml/ns/mrcpv2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user