mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[ui] Free the label when freeing the state
Plugs a memory leak.
This commit is contained in:
parent
104fba13a6
commit
a92754caf1
1 changed files with 2 additions and 1 deletions
|
@ -121,11 +121,11 @@ imui_get_state (imui_ctx_t *ctx, const char *label)
|
||||||
uint32_t label_len = ~0u;
|
uint32_t label_len = ~0u;
|
||||||
const char *key = strstr (label, "##");
|
const char *key = strstr (label, "##");
|
||||||
if (key) {
|
if (key) {
|
||||||
|
label_len = key - label;
|
||||||
// key is '###': hash only past this
|
// key is '###': hash only past this
|
||||||
if (key[2] == '#') {
|
if (key[2] == '#') {
|
||||||
key_offset = (key += 3) - label;
|
key_offset = (key += 3) - label;
|
||||||
}
|
}
|
||||||
label_len = key - label;
|
|
||||||
}
|
}
|
||||||
imui_state_t *state = Hash_Find (ctx->tab, label + key_offset);
|
imui_state_t *state = Hash_Find (ctx->tab, label + key_offset);
|
||||||
if (state) {
|
if (state) {
|
||||||
|
@ -250,6 +250,7 @@ prune_objects (imui_ctx_t *ctx)
|
||||||
s = &(*s)->next;
|
s = &(*s)->next;
|
||||||
} else {
|
} else {
|
||||||
Hash_Del (ctx->tab, (*s)->label + (*s)->key_offset);
|
Hash_Del (ctx->tab, (*s)->label + (*s)->key_offset);
|
||||||
|
free ((*s)->label);
|
||||||
imui_state_free (ctx, *s);
|
imui_state_free (ctx, *s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue