Prevent some heap corruptions/exceptions

This commit is contained in:
twinaphex 2018-01-23 03:41:25 +01:00
parent 93561a042b
commit 6a47669d21
4 changed files with 7 additions and 4 deletions

View File

@ -22,6 +22,7 @@ FILE* fopen_utf8(const char * filename, const char * mode)
if (!filename_local)
return NULL;
ret = fopen(filename_local, mode);
if (filename_local)
free(filename_local);
return ret;
#else

View File

@ -1220,7 +1220,7 @@ bool rpng_set_buf_ptr(rpng_t *rpng, void *data)
rpng_t *rpng_alloc(void)
{
rpng_t *rpng = (rpng_t*)calloc(1, sizeof(rpng_t));
rpng_t *rpng = (rpng_t*)calloc(1, sizeof(*rpng));
if (!rpng)
return NULL;
return rpng;

View File

@ -69,6 +69,7 @@ static void zlib_inflate_stream_free(void *data)
return;
if (z->inited)
inflateEnd(&z->z);
if (z)
free(z);
}

View File

@ -3893,6 +3893,7 @@ static void xmb_context_reset(void *data, bool is_threaded)
xmb_update_thumbnail_image(xmb);
xmb_update_savestate_thumbnail_image(xmb);
if (iconpath)
free(iconpath);
}
}