revert my pass through the tree to remove checks of the result of ast_strdupa
[asterisk/asterisk.git] / apps / app_sayunixtime.c
index 4739d97..cde4e65 100644 (file)
@@ -92,21 +92,26 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
        } 
 
        if (data) {
-               s = ast_strdupa(data);
-               timec = strsep(&s,"|");
-               if ((timec) && (*timec != '\0')) {
-                       long timein;
-                       if (sscanf(timec,"%ld",&timein) == 1) {
-                               unixtime = (time_t)timein;
-                       }
-               }
+               s = data;
+               s = ast_strdupa(s);
                if (s) {
-                       zone = strsep(&s,"|");
-                       if (zone && (*zone == '\0'))
-                               zone = NULL;
+                       timec = strsep(&s,"|");
+                       if ((timec) && (*timec != '\0')) {
+                               long timein;
+                               if (sscanf(timec,"%ld",&timein) == 1) {
+                                       unixtime = (time_t)timein;
+                               }
+                       }
                        if (s) {
-                               format = s;
+                               zone = strsep(&s,"|");
+                               if (zone && (*zone == '\0'))
+                                       zone = NULL;
+                               if (s) {
+                                       format = s;
+                               }
                        }
+               } else {
+                       ast_log(LOG_ERROR, "Out of memory error\n");
                }
        }