# HG changeset patch
# User David A. Holland
# Date 1364694537 14400
# Node ID 291fefe664f2235b21c6936d3dda2b683a164aaa
# Parent  337110e7240ab1d7d52ba5185fdb8ecb55c78154
Oops, fix previous.

diff -r 337110e7240a -r 291fefe664f2 macro.c
--- 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;