src/aiff.c : Fix potential memory leak in handling of 'MARK' chunk.

This commit is contained in:
Erik de Castro Lopo 2009-02-22 16:57:16 +11:00
parent af03cbfac4
commit c924272b52
2 changed files with 13 additions and 1 deletions

View File

@ -18,6 +18,12 @@
* tests/win32_test.c
Add missing close on file descriptor.
* src/nist.c programs/sndfile-metadata-set.c
Fix 'unused variable' warnings.
* src/aiff.c
Fix potential memory leak in handling of 'MARK' chunk.
2009-02-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/sd2.c

View File

@ -763,8 +763,14 @@ aiff_read_header (SF_PRIVATE *psf, COMM_CHUNK *comm_fmt)
bytesread = psf_binheader_readf (psf, "E2", &n) ;
mark_count = n ;
markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
psf_log_printf (psf, " Count : %d\n", mark_count) ;
if (markstr != NULL)
{ psf_log_printf (psf, "*** Second MARK chunk found. Throwing away the first.\n") ;
free (markstr) ;
} ;
markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
if (markstr == NULL)
return SFE_MALLOC_FAILED ;
for (n = 0 ; n < mark_count && bytesread < dword ; n++)
{ bytesread += psf_binheader_readf (psf, "E241", &mark_id, &position, &pstr_len) ;