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:
Aaron Giles 2009-01-04 22:59:10 +00:00
parent 788c7e6a60
commit 5406ec6027

View File

@ -717,6 +717,7 @@ int main(int argc, char *argv[])
bitmap = bitmap_alloc(info.width, info.height, BITMAP_FORMAT_YUY16);
if (bitmap == NULL)
{
isavi ? close_avi(file) : close_chd(file);
fprintf(stderr, "Out of memory creating %dx%d bitmap\n", info.width, info.height);
return 1;
}
@ -726,6 +727,12 @@ int main(int argc, char *argv[])
rsound = malloc(info.samplerate * sizeof(*rsound));
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)));
return 1;
}