diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2019-08-15 21:19:50 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2019-08-15 21:19:50 +0300 |
commit | 98e500ff3ceb035d9d42acf25aa365940cf47568 (patch) | |
tree | 8c33627bfe255de53f76d4e38f3fe07ca58d15dc /builtin.c | |
parent | c7c3998ed9d96b61d03c675b2105ca5da77b9bfd (diff) | |
download | egawk-98e500ff3ceb035d9d42acf25aa365940cf47568.tar.gz egawk-98e500ff3ceb035d9d42acf25aa365940cf47568.tar.bz2 egawk-98e500ff3ceb035d9d42acf25aa365940cf47568.zip |
Avoid memory growth in format_tree.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -685,7 +685,7 @@ format_tree( int i, nc; bool toofew = false; char *obuf, *obufout; - size_t osiz, ofre, olen_final; + size_t osiz, ofre; const char *chbuf; const char *s0, *s1; int cs1; @@ -1646,10 +1646,7 @@ mpf1: _("too many arguments supplied for format string")); } bchunk(s0, s1 - s0); - olen_final = obufout - obuf; - if (ofre > 0) - erealloc(obuf, char *, olen_final + 1, "format_tree"); - r = make_str_node(obuf, olen_final, ALREADY_MALLOCED); + r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED); obuf = NULL; out: { |