mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-30 16:30:43 +00:00
[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:
parent
9146860f70
commit
70aa970c32
25 changed files with 31 additions and 2 deletions
|
@ -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 *
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue