fix seg fault when the parked call that timed out was the last one in the list
[asterisk/asterisk.git] / res / res_clioriginate.c
index 1c02491..7303d4b 100644 (file)
  * 
  */
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
 
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
 #include "asterisk/logger.h"
@@ -76,8 +76,7 @@ static int orig_app(int fd, const char *chan, const char *app, const char *appda
        if (ast_strlen_zero(app))
                return RESULT_SHOWUSAGE;
 
-       if (!(chandata = ast_strdupa(chan)))
-               return RESULT_FAILURE;
+       chandata = ast_strdupa(chan);
        
        chantech = strsep(&chandata, "/");
        if (!chandata) {
@@ -98,8 +97,7 @@ static int orig_exten(int fd, const char *chan, const char *data)
        char *context = NULL;
        int reason = 0;
 
-       if (!(chandata = ast_strdupa(chan)))
-               return RESULT_FAILURE;
+       chandata = ast_strdupa(chan);
        
        chantech = strsep(&chandata, "/");
        if (!chandata) {
@@ -108,8 +106,7 @@ static int orig_exten(int fd, const char *chan, const char *data)
        }
 
        if (!ast_strlen_zero(data)) {
-               if (!(context = ast_strdupa(data)))
-                       return RESULT_FAILURE;
+               context = ast_strdupa(data);
                exten = strsep(&context, "@");
        }