aboutsummaryrefslogtreecommitdiff
path: root/src/ctemplates.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ctemplates.c')
-rw-r--r--src/ctemplates.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ctemplates.c b/src/ctemplates.c
index fb055e6..74d6098 100644
--- a/src/ctemplates.c
+++ b/src/ctemplates.c
@@ -1257,9 +1257,15 @@ TMPL_render_helper(struct TMPL_templates* t, struct TMPL_varlist* varlist){
char*
TMPL_render(struct TMPL_templates* t, struct TMPL_varlist* varlist, size_t* size_p){
int err;
+ /*Reset the output buffer*/
if(t->out != NULL){
free_tmpl_buf(t->out);
}
+ /*Reset the error buffer, if needed*/
+ if(t->errout != NULL && t->errout->total_len > 0){
+ free_tmpl_buf(t->errout);
+ t->errout = alloc_tmpl_buf();
+ }
t->out = alloc_tmpl_buf();
t->cursor = t->roottag;
err = TMPL_render_helper(t,varlist);