From 9a669d88e29de2f25532688b494580a48f8a31b8 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 25 Oct 1999 16:30:38 +0000 Subject: Fix yet another error-handling segfault [originally from svn r257] --- index.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- cgit v1.1