aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer.c')
-rw-r--r--src/renderer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/renderer.c b/src/renderer.c
index 351dfb1..c9cc15b 100644
--- a/src/renderer.c
+++ b/src/renderer.c
@@ -111,10 +111,10 @@ blogc_format_variable(const char *name, sb_trie_t *global, sb_trie_t *local,
else
value = blogc_get_variable(var, global, local);
- free(var);
-
- if (value == NULL)
+ if (value == NULL) {
+ free(var);
return NULL;
+ }
char *rv = NULL;
@@ -132,6 +132,8 @@ blogc_format_variable(const char *name, sb_trie_t *global, sb_trie_t *local,
rv = sb_strdup(value);
}
+ free(var);
+
if (len > 0) {
char *tmp = sb_strndup(rv, len);
free(rv);