summaryrefslogtreecommitdiff
path: root/index.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-10-25 16:30:38 +0000
committerSimon Tatham <anakin@pobox.com>1999-10-25 16:30:38 +0000
commit9a669d88e29de2f25532688b494580a48f8a31b8 (patch)
treeecb7c4fe51c0fd92b00f73db02f228bc91c0e736 /index.c
parent58b8771ff9a9c397ea49605db216a5e5a777c057 (diff)
downloadhalibut-9a669d88e29de2f25532688b494580a48f8a31b8.zip
halibut-9a669d88e29de2f25532688b494580a48f8a31b8.tar.gz
halibut-9a669d88e29de2f25532688b494580a48f8a31b8.tar.bz2
halibut-9a669d88e29de2f25532688b494580a48f8a31b8.tar.xz
Fix yet another error-handling segfault
[originally from svn r257]
Diffstat (limited to 'index.c')
-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);