[gamecode] Make modules responsible for freeing resources

It should have been this way all along, and it seems I thought they were
when I did rua_gui.c as it already freed its resource block, which would
have been a double free (oops). Fixes an invalid write when shutting
down progs in qwaq-cmd (relevant change not committed).
This commit is contained in:
Bill Currie 2023-03-03 19:36:28 +09:00
parent 9146860f70
commit 70aa970c32
25 changed files with 31 additions and 2 deletions

View file

@ -407,6 +407,8 @@ pr_debug_destroy (progs_t *pr, void *_res)
Hash_DelTable (res->compunits);
pr->pr_debug_resources = 0;
free (res);
}
static file_t *

View file

@ -79,7 +79,6 @@ PR_Resources_Shutdown (progs_t *pr)
while (res) {
pr_resource_t *t = res->next;
res->destroy (pr, res->data);
free (res->data);
free (res);
res = t;
}

View file

@ -241,6 +241,8 @@ pr_strings_destroy (progs_t *pr, void *_res)
dstring_delete (res->print_str);
Hash_DelTable (res->strref_hash);
pr->pr_string_resources = 0;
free (res);
}
VISIBLE int