mirror of
https://github.com/ioquake/ioq3.git
synced 2025-06-02 01:42:12 +00:00
* Make some botlib memory allocations /potentially/ safer
This commit is contained in:
parent
4f0565a4a7
commit
dfc97a1dfa
2 changed files with 10 additions and 8 deletions
|
@ -84,9 +84,9 @@ libvar_t *LibVarAlloc(char *var_name)
|
|||
{
|
||||
libvar_t *v;
|
||||
|
||||
v = (libvar_t *) GetMemory(sizeof(libvar_t) + strlen(var_name) + 1);
|
||||
v = (libvar_t *) GetMemory(sizeof(libvar_t));
|
||||
Com_Memset(v, 0, sizeof(libvar_t));
|
||||
v->name = (char *) v + sizeof(libvar_t);
|
||||
v->name = (char *) GetMemory(strlen(var_name)+1);
|
||||
strcpy(v->name, var_name);
|
||||
//add the variable in the list
|
||||
v->next = libvarlist;
|
||||
|
@ -102,6 +102,7 @@ libvar_t *LibVarAlloc(char *var_name)
|
|||
void LibVarDeAlloc(libvar_t *v)
|
||||
{
|
||||
if (v->string) FreeMemory(v->string);
|
||||
FreeMemory(v->name);
|
||||
FreeMemory(v);
|
||||
} //end of the function LibVarDeAlloc
|
||||
//===========================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue