aboutsummaryrefslogtreecommitdiffstats
path: root/main/ast_expr2f.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 19:40:33 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-06 19:40:33 +0000
commitf258e584447d8830fd45677b204c5e8953ea0867 (patch)
tree7dfe89698a487ace5e46301c3fa2936e158909fc /main/ast_expr2f.c
parentf063aa43f4fb93d31643a2e1eebf37bb846e29b2 (diff)
Hoping to avoid a crash in OSX for a problem blitzrage found
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89051 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/ast_expr2f.c')
-rw-r--r--main/ast_expr2f.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c
index 243046558..c9ae8defd 100644
--- a/main/ast_expr2f.c
+++ b/main/ast_expr2f.c
@@ -3207,13 +3207,17 @@ int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
res_length = snprintf(buf, length, FP___PRINTF, io.val->u.i);
return_value = (res_length <= length) ? res_length : length;
} else {
+ if (io.val->u.s)
#if defined(STANDALONE) || defined(LOW_MEMORY) || defined(STANDALONE_AEL)
- strncpy(buf, io.val->u.s, length - 1);
+ strncpy(buf, io.val->u.s, length - 1);
#else /* !STANDALONE && !LOW_MEMORY */
- ast_copy_string(buf, io.val->u.s, length);
+ ast_copy_string(buf, io.val->u.s, length);
#endif /* STANDALONE || LOW_MEMORY */
+ else
+ buf[0] = 0;
return_value = strlen(buf);
- free(io.val->u.s);
+ if (io.val->u.s)
+ free(io.val->u.s);
}
free(io.val);
}