revert my pass through the tree to remove checks of the result of ast_strdupa
[asterisk/asterisk.git] / apps / app_random.c
index 2ebd437..f7d09e8 100644 (file)
@@ -74,6 +74,11 @@ static int random_exec(struct ast_channel *chan, void *data)
        LOCAL_USER_ADD(u);
 
        s = ast_strdupa(data);
+       if (!s) {
+               ast_log(LOG_ERROR, "Out of memory!\n");
+               LOCAL_USER_REMOVE(u);
+               return -1;
+       }
 
        prob = strsep(&s,":");
        if ((!prob) || (sscanf(prob, "%d", &probint) != 1))