aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--mpfr.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 882f7f4f..6e053f7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * mpfr.c (mpg_format_val): Set STRCUR flag when we're done.
+ Fixes a memory leak. Thanks to valgrind for the report.
+
2017-04-12 Manuel Collado <m-collado@users.sourceforge.net>
Fix the FPAT bug reported by Ed Morton in the gawk-bug mailing list.
diff --git a/mpfr.c b/mpfr.c
index ec8d5561..5a2a35d3 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -384,6 +384,7 @@ mpg_format_val(const char *format, int index, NODE *s)
if ((s->flags & (MALLOC|STRCUR)) == (MALLOC|STRCUR))
efree(s->stptr);
s->stptr = r->stptr;
+ s->flags |= STRCUR;
freenode(r); /* Do not unref(r)! We want to keep s->stptr == r->stpr. */
free_wstr(s);
return s;