changeset 40:291fefe664f2

Oops, fix previous.
author David A. Holland
date Sat, 30 Mar 2013 21:48:57 -0400
parents 337110e7240a
children ef8bedab8a4b
files macro.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/macro.c	Sat Mar 30 21:17:47 2013 -0400
+++ b/macro.c	Sat Mar 30 21:48:57 2013 -0400
@@ -1102,11 +1102,14 @@
 	expstate_init(&es, true, honordefined);
 	doexpand(&es, p, buf, len);
 	expand_got_eof(&es, p);
+
+	/* trim to fit, so the malloc debugging won't complain */
+	es.buf = dorealloc(es.buf, es.bufmax, strlen(es.buf) + 1);
+
 	ret = es.buf;
 	es.buf = NULL;
-	/* trim to fit, so the malloc debugging won't complain */
-	ret = dorealloc(es.buf, es.bufmax, strlen(es.buf) + 1);
 	es.bufpos = es.bufmax = 0;
+
 	expstate_cleanup(&es);
 
 	return ret;