revert my pass through the tree to remove checks of the result of ast_strdupa
[asterisk/asterisk.git] / funcs / func_logic.c
index 5f324c6..d1d96ab 100644 (file)
@@ -55,7 +55,10 @@ static char *builtin_function_iftime(struct ast_channel *chan, char *cmd, char *
        char *iftrue;
        char *iffalse;
 
-       data = ast_strdupa(data);
+       if (!(data = ast_strdupa(data))) {
+               ast_log(LOG_WARNING, "Memory Error!\n");
+               return NULL;
+       }
 
        data = ast_strip_quoted(data, "\"", "\"");
        expr = strsep(&data, "?");
@@ -92,7 +95,10 @@ static char *builtin_function_if(struct ast_channel *chan, char *cmd, char *data
        char *iftrue;
        char *iffalse;
 
-       data = ast_strdupa(data);
+       if (!(data = ast_strdupa(data))) {
+               ast_log(LOG_WARNING, "Memory Error!\n");
+               return NULL;
+       }
 
        data = ast_strip_quoted(data, "\"", "\"");
        expr = strsep(&data, "?");
@@ -123,7 +129,10 @@ static char *builtin_function_set(struct ast_channel *chan, char *cmd, char *dat
        char *varname;
        char *val;
 
-       data = ast_strdupa(data);
+       if (!(data = ast_strdupa(data))) {
+               ast_log(LOG_WARNING, "Memory Error!\n");
+               return NULL;
+       }
 
        varname = strsep(&data, "=");
        val = data;