mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-19 07:51:08 +00:00
[util] Fix a linked-list error in segtext
Uncovered by the memory leak cleanup: the nodes were all being "linked" to the first node, those nodes in between the first and last were getting lost.
This commit is contained in:
parent
13f8f2b66b
commit
d8466b6cca
1 changed files with 3 additions and 1 deletions
|
@ -163,6 +163,7 @@ Segtext_new (const char *source_string)
|
|||
// If tags are duplicated, the first one takes precedence
|
||||
if ((*chunk)->tag && !Hash_Find (text->tab, (*chunk)->tag))
|
||||
Hash_Add (text->tab, *chunk);
|
||||
chunk = &(*chunk)->next;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
@ -177,8 +178,9 @@ Segtext_delete (segtext_t *st)
|
|||
while (st->chunk_list) {
|
||||
chunk = st->chunk_list;
|
||||
st->chunk_list = chunk->next;
|
||||
if (chunk->tag)
|
||||
if (chunk->tag) {
|
||||
free ((char *) chunk->tag);
|
||||
}
|
||||
delete_chunk (chunk);
|
||||
}
|
||||
Hash_DelTable (st->tab);
|
||||
|
|
Loading…
Reference in a new issue