mirror of
https://github.com/holub/mame
synced 2025-05-23 14:19:01 +03:00
This patch just cleans up some memory and file handles in the error
cases of ldverify. The initial memory leak was rsound and exposed by cppcheck [Oliver Stoeneberg]
This commit is contained in:
parent
788c7e6a60
commit
5406ec6027
@ -717,6 +717,7 @@ int main(int argc, char *argv[])
|
|||||||
bitmap = bitmap_alloc(info.width, info.height, BITMAP_FORMAT_YUY16);
|
bitmap = bitmap_alloc(info.width, info.height, BITMAP_FORMAT_YUY16);
|
||||||
if (bitmap == NULL)
|
if (bitmap == NULL)
|
||||||
{
|
{
|
||||||
|
isavi ? close_avi(file) : close_chd(file);
|
||||||
fprintf(stderr, "Out of memory creating %dx%d bitmap\n", info.width, info.height);
|
fprintf(stderr, "Out of memory creating %dx%d bitmap\n", info.width, info.height);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -726,6 +727,12 @@ int main(int argc, char *argv[])
|
|||||||
rsound = malloc(info.samplerate * sizeof(*rsound));
|
rsound = malloc(info.samplerate * sizeof(*rsound));
|
||||||
if (lsound == NULL || rsound == NULL)
|
if (lsound == NULL || rsound == NULL)
|
||||||
{
|
{
|
||||||
|
isavi ? close_avi(file) : close_chd(file);
|
||||||
|
bitmap_free(bitmap);
|
||||||
|
if (rsound != NULL)
|
||||||
|
free(rsound);
|
||||||
|
if (lsound != NULL)
|
||||||
|
free(lsound);
|
||||||
fprintf(stderr, "Out of memory allocating sound buffers of %d bytes\n", (INT32)(info.samplerate * sizeof(*rsound)));
|
fprintf(stderr, "Out of memory allocating sound buffers of %d bytes\n", (INT32)(info.samplerate * sizeof(*rsound)));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user