From 4a2054a9515191784181019aa17409413c4e7ab3 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 4 Dec 2013 20:18:09 -0500 Subject: [PATCH] mod_rayo: doh- fix adhearsionconf core dump --- src/mod/event_handlers/mod_rayo/mod_rayo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index 6d95d28885..a6b749a869 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -3936,10 +3936,15 @@ static int presence_api(char *cmd, switch_stream_handle_t *stream) SWITCH_STANDARD_API(rayo_api) { struct rayo_cmd_alias *alias; - char *cmd_dup = strdup(cmd); + char *cmd_dup = NULL; char *argv[2] = { 0 }; int success = 0; + if (zstr(cmd) ) { + goto done; + } + + cmd_dup = strdup(cmd); switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0])); /* check if a command alias */ @@ -3957,11 +3962,12 @@ SWITCH_STANDARD_API(rayo_api) success = presence_api(argv[1], stream); } +done: if (!success) { stream->write_function(stream, "-ERR: USAGE %s\n", RAYO_API_SYNTAX); } - free(cmd_dup); + switch_safe_free(cmd_dup); return SWITCH_STATUS_SUCCESS; }