mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
plug some memory leaks
This commit is contained in:
parent
6c6f78158e
commit
addb57bfb3
5 changed files with 27 additions and 3 deletions
|
@ -554,12 +554,16 @@ qfs_load_config (void)
|
|||
buf[0] = '{';
|
||||
buf[len + 1] = '}';
|
||||
buf[len + 2] = 0;
|
||||
if (qfs_gd_plist)
|
||||
PL_Free (qfs_gd_plist);
|
||||
qfs_gd_plist = PL_GetPropertyList (buf);
|
||||
free (buf);
|
||||
if (qfs_gd_plist && qfs_gd_plist->type == QFDictionary)
|
||||
return; // done
|
||||
Sys_Printf ("not a dictionary\n");
|
||||
no_config:
|
||||
if (qfs_gd_plist)
|
||||
PL_Free (qfs_gd_plist);
|
||||
qfs_gd_plist = PL_GetPropertyList (qfs_default_dirconf);
|
||||
}
|
||||
|
||||
|
|
|
@ -387,11 +387,13 @@ Sys_Init_Cvars (void)
|
|||
void
|
||||
Sys_Shutdown (void)
|
||||
{
|
||||
shutdown_list_t *p = shutdown_list;
|
||||
shutdown_list_t *p = shutdown_list, *t;
|
||||
|
||||
while (p) {
|
||||
p->func ();
|
||||
t = p;
|
||||
p = p->next;
|
||||
free (t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@ static __attribute__ ((unused)) const char rcsid[] =
|
|||
|
||||
static hashtab_t *connections;
|
||||
|
||||
static void
|
||||
connection_free (void *_c, void *unused)
|
||||
{
|
||||
free (_c);
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
connection_get_hash (void *_c, void *unused)
|
||||
{
|
||||
|
@ -76,7 +82,7 @@ connection_compare (void *_c1, void *_c2, void *unused)
|
|||
void
|
||||
Connection_Init (void)
|
||||
{
|
||||
connections = Hash_NewTable (1023, 0, 0, 0);
|
||||
connections = Hash_NewTable (1023, 0, connection_free, 0);
|
||||
Hash_SetHashCompare (connections, connection_get_hash, connection_compare);
|
||||
}
|
||||
|
||||
|
@ -99,7 +105,7 @@ Connection_Add (netadr_t *address, void *object,
|
|||
void
|
||||
Connection_Del (connection_t *con)
|
||||
{
|
||||
Hash_DelElement (connections, con);
|
||||
Hash_Free (connections, Hash_DelElement (connections, con));
|
||||
}
|
||||
|
||||
connection_t *
|
||||
|
|
|
@ -222,6 +222,8 @@ qtv_shutdown (void)
|
|||
{
|
||||
NET_Shutdown ();
|
||||
Con_Shutdown ();
|
||||
Cbuf_Delete (qtv_cbuf);
|
||||
Cbuf_ArgsDelete (qtv_args);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -81,6 +81,13 @@ server_free (void *_sv, void *unused)
|
|||
if (sv->connected)
|
||||
Netchan_Transmit (&sv->netchan, sizeof (final), final);
|
||||
Connection_Del (sv->con);
|
||||
Info_Destroy (sv->info);
|
||||
free ((char *) sv->name);
|
||||
free ((char *) sv->address);
|
||||
if (sv->gamedir)
|
||||
free ((char *) sv->gamedir);
|
||||
if (sv->message)
|
||||
free ((char *) sv->message);
|
||||
|
||||
for (s = &servers; *s; s = &(*s)->next) {
|
||||
if (*s == sv) {
|
||||
|
@ -88,6 +95,7 @@ server_free (void *_sv, void *unused)
|
|||
break;
|
||||
}
|
||||
}
|
||||
free (sv);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -122,6 +130,7 @@ qtv_serverdata (server_t *sv)
|
|||
|
||||
COM_TokenizeString (MSG_ReadString (net_message), qtv_args);
|
||||
cmd_args = qtv_args;
|
||||
Info_Destroy (sv->info);
|
||||
sv->info = Info_ParseString (Cmd_Argv (1), MAX_SERVERINFO_STRING, 0);
|
||||
|
||||
str = Info_ValueForKey (sv->info, "hostname");
|
||||
|
@ -869,6 +878,7 @@ static void
|
|||
server_shutdown (void)
|
||||
{
|
||||
Hash_FlushTable (server_hash);
|
||||
Hash_DelTable (server_hash);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue