mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-09 23:02:02 +00:00
client: Fix memory leaks
This commit is contained in:
parent
33ebf6c193
commit
b3efe338c1
3 changed files with 45 additions and 9 deletions
|
@ -5712,10 +5712,18 @@ HasSkinsInDir(const char *dirname, int *num)
|
|||
|
||||
for (j = 0; j < num_png; j ++)
|
||||
{
|
||||
if (list_png[j] && !strchr(list_png[j] + dirname_size, '/'))
|
||||
if (list_png[j])
|
||||
{
|
||||
*curr = list_png[j];
|
||||
curr++;
|
||||
if (!strchr(list_png[j] + dirname_size, '/'))
|
||||
{
|
||||
*curr = list_png[j];
|
||||
curr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unused in final response */
|
||||
free(list_png[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5728,10 +5736,18 @@ HasSkinsInDir(const char *dirname, int *num)
|
|||
|
||||
for (j = 0; j < num_pcx; j ++)
|
||||
{
|
||||
if (list_pcx[j] && !strchr(list_pcx[j] + dirname_size, '/'))
|
||||
if (list_pcx[j])
|
||||
{
|
||||
*curr = list_pcx[j];
|
||||
curr++;
|
||||
if (!strchr(list_pcx[j] + dirname_size, '/'))
|
||||
{
|
||||
*curr = list_pcx[j];
|
||||
curr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unused in final response */
|
||||
free(list_pcx[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5744,10 +5760,18 @@ HasSkinsInDir(const char *dirname, int *num)
|
|||
|
||||
for (j = 0; j < num_m8; j ++)
|
||||
{
|
||||
if (list_m8[j] && !strchr(list_m8[j] + dirname_size, '/'))
|
||||
if (list_m8[j])
|
||||
{
|
||||
*curr = list_m8[j];
|
||||
curr++;
|
||||
if (!strchr(list_m8[j] + dirname_size, '/'))
|
||||
{
|
||||
*curr = list_m8[j];
|
||||
curr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* unused in final response */
|
||||
free(list_m8[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -880,6 +880,12 @@ FS_LoadFile(const char *path, void **buffer)
|
|||
|
||||
if (size <= 0)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
/* empty file, close before exit*/
|
||||
FS_FCloseFile(f);
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
*buffer = NULL;
|
||||
|
|
|
@ -175,6 +175,12 @@ Mod_LoadFileMD5Merge(const char *namewe, void **buffer)
|
|||
i, md5skinname);
|
||||
}
|
||||
}
|
||||
|
||||
/* clean up original buffer */
|
||||
if (skins)
|
||||
{
|
||||
free(skins);
|
||||
}
|
||||
}
|
||||
|
||||
/* prepare final file */
|
||||
|
|
Loading…
Reference in a new issue