mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
[gamecode] Yet more leaks
This commit is contained in:
parent
9605de53d7
commit
f256ab167d
2 changed files with 17 additions and 0 deletions
|
@ -1988,9 +1988,17 @@ PR_Debug_Init (progs_t *pr)
|
||||||
pr->pr_debug_resources = res;
|
pr->pr_debug_resources = res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pr_debug_shutdown (void *data)
|
||||||
|
{
|
||||||
|
free (source_paths);
|
||||||
|
free (source_path_string);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PR_Debug_Init_Cvars (void)
|
PR_Debug_Init_Cvars (void)
|
||||||
{
|
{
|
||||||
|
Sys_RegisterShutdown (pr_debug_shutdown, 0);
|
||||||
Cvar_Register (&pr_debug_cvar, 0, 0);
|
Cvar_Register (&pr_debug_cvar, 0, 0);
|
||||||
Cvar_Register (&pr_source_path_cvar, source_path_f, 0);
|
Cvar_Register (&pr_source_path_cvar, source_path_f, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "QF/darray.h"
|
||||||
#include "QF/dstring.h"
|
#include "QF/dstring.h"
|
||||||
#include "QF/hash.h"
|
#include "QF/hash.h"
|
||||||
#include "QF/progs.h"
|
#include "QF/progs.h"
|
||||||
|
@ -88,6 +89,7 @@ typedef struct prstr_resources_s {
|
||||||
unsigned dyn_str_size;
|
unsigned dyn_str_size;
|
||||||
struct hashtab_s *strref_hash;
|
struct hashtab_s *strref_hash;
|
||||||
int num_strings;
|
int num_strings;
|
||||||
|
struct DARRAY_TYPE (fmt_item_t *) fmt_item_blocks;
|
||||||
fmt_item_t *free_fmt_items;
|
fmt_item_t *free_fmt_items;
|
||||||
dstring_t *print_str;
|
dstring_t *print_str;
|
||||||
prstr_at_handler_t at_handler;
|
prstr_at_handler_t at_handler;
|
||||||
|
@ -248,6 +250,11 @@ pr_strings_destroy (progs_t *pr, void *_res)
|
||||||
}
|
}
|
||||||
free (res->string_map);
|
free (res->string_map);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < res->fmt_item_blocks.size; i++) {
|
||||||
|
free (res->fmt_item_blocks.a[i]);
|
||||||
|
}
|
||||||
|
DARRAY_CLEAR (&res->fmt_item_blocks);
|
||||||
|
|
||||||
pr->pr_string_resources = 0;
|
pr->pr_string_resources = 0;
|
||||||
free (res);
|
free (res);
|
||||||
}
|
}
|
||||||
|
@ -848,6 +855,7 @@ new_fmt_item (prstr_resources_t *res)
|
||||||
for (i = 0; i < 15; i++)
|
for (i = 0; i < 15; i++)
|
||||||
res->free_fmt_items[i].next = res->free_fmt_items + i + 1;
|
res->free_fmt_items[i].next = res->free_fmt_items + i + 1;
|
||||||
res->free_fmt_items[i].next = 0;
|
res->free_fmt_items[i].next = 0;
|
||||||
|
DARRAY_APPEND (&res->fmt_item_blocks, res->free_fmt_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
fi = res->free_fmt_items;
|
fi = res->free_fmt_items;
|
||||||
|
@ -1300,6 +1308,7 @@ PR_Strings_Init (progs_t *pr)
|
||||||
res->print_str = dstring_new ();
|
res->print_str = dstring_new ();
|
||||||
res->strref_hash = Hash_NewTable (1021, strref_get_key, strref_free,
|
res->strref_hash = Hash_NewTable (1021, strref_get_key, strref_free,
|
||||||
res, pr->hashctx);
|
res, pr->hashctx);
|
||||||
|
DARRAY_INIT (&res->fmt_item_blocks, 8);
|
||||||
|
|
||||||
PR_Resources_Register (pr, "Strings", res, pr_strings_clear,
|
PR_Resources_Register (pr, "Strings", res, pr_strings_clear,
|
||||||
pr_strings_destroy);
|
pr_strings_destroy);
|
||||||
|
|
Loading…
Reference in a new issue