summaryrefslogtreecommitdiff
path: root/main/ast_expr2.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-07-27 21:58:22 -0400
committerGeorge Joseph <gjoseph@digium.com>2017-08-01 15:39:25 -0600
commit7c3cdc81f7c7397b545322e0215f3e93526469ca (patch)
tree7a8a3241c2efab7425779ff5117d72f4da591696 /main/ast_expr2.c
parent1078d4f7f6cb0e68f135f96ebb43c2ea4c0f0905 (diff)
Fix compiler warnings on Fedora 26 / GCC 7.
GCC 7 has added capability to produce warnings, this fixes most of those warnings. The specific warnings are disabled in a few places: * app_voicemail.c: truncation of paths more than 4096 chars in many places. * chan_mgcp.c: callid truncated to 80 chars. * cdr.c: two userfields are combined to cdr copy, fix would break ABI. * tcptls.c: ignore use of deprecated method SSLv3_client_method(). ASTERISK-27156 #close Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
Diffstat (limited to 'main/ast_expr2.c')
-rw-r--r--main/ast_expr2.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/main/ast_expr2.c b/main/ast_expr2.c
index 4b06ffe91..093b441d0 100644
--- a/main/ast_expr2.c
+++ b/main/ast_expr2.c
@@ -2635,13 +2635,11 @@ to_string (struct val *vp)
if (vp->type == AST_EXPR_string || vp->type == AST_EXPR_numeric_string)
return;
- tmp = malloc ((size_t)25);
- if (tmp == NULL) {
- ast_log(LOG_WARNING,"malloc() failed\n");
+ if (asprintf(&tmp, FP___PRINTF, vp->u.i) == -1) {
+ ast_log(LOG_WARNING, "asprintf() failed\n");
return;
}
- sprintf(tmp, FP___PRINTF, vp->u.i);
vp->type = AST_EXPR_string;
vp->u.s = tmp;
}