diff --git a/ChangeLog b/ChangeLog index e4769cfa..1b02bb5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 * src/sd2.c diff --git a/src/aiff.c b/src/aiff.c index d4e27e7f..6b171c1f 100644 --- a/src/aiff.c +++ b/src/aiff.c @@ -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) ;