summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/index.c b/index.c
index a6d30f8..1b1f4c1 100644
--- a/index.c
+++ b/index.c
@@ -75,6 +75,11 @@ void index_merge(index *idx, int is_explicit, wchar_t *tags, word *text) {
existing = add23(idx->tags, t, compare_tags);
if (existing == t) {
/*
+ * Duplicate this so we can free it independently.
+ */
+ t->name = ustrdup(tags);
+
+ /*
* Every tag has an implicit \IM. So if this tag
* doesn't exist and we're explicit, then we should
* warn (and drop it, since it won't be referenced).
@@ -83,10 +88,10 @@ void index_merge(index *idx, int is_explicit, wchar_t *tags, word *text) {
error(err_nosuchidxtag, tags);
continue;
}
+
/*
* Otherwise, this is a new tag with an implicit \IM.
*/
- t->name = ustrdup(tags);
t->implicit_text = text;
} else {
sfree(t);