aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/decoder/_flac_common.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index d312b6d97..3da38e8d4 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.15.2 (2009/??/??)
* decoders:
- mad: skip ID3 frames when libid3tag is disabled
- flac: parse all replaygain tags
+ - flac: don't allocate cuesheet twice (memleak)
* update: free empty path string (memleak)
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index ae7d039ce..e096750f3 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -377,13 +377,15 @@ char*
flac_cue_track( const char* pathname,
const unsigned int tnum)
{
- FLAC__StreamMetadata* cs = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET);
+ FLAC__bool success;
+ FLAC__StreamMetadata* cs;
- FLAC__metadata_get_cuesheet(pathname, &cs);
-
- if (cs == NULL)
+ success = FLAC__metadata_get_cuesheet(pathname, &cs);
+ if (!success)
return NULL;
+ assert(cs != NULL);
+
if (cs->data.cue_sheet.num_tracks <= 1)
{
FLAC__metadata_object_delete(cs);