shithub: sox

Download patch

ref: 627a9c0a8cd9f9222e4b216763b00f8b9f6962ca
parent: 3ff4284e6549cb5c4587207747ff8079b7d7483d
author: rrt <rrt>
date: Mon Dec 11 22:32:44 EST 2006

Fix a FIXME.

--- a/src/flac.c
+++ b/src/flac.c
@@ -238,6 +238,7 @@
   unsigned number_of_samples;
 
   FLAC__StreamEncoder * flac;
+  FLAC__StreamMetadata *metadata;
 } Encoder;
 
 
@@ -364,8 +365,7 @@
     FLAC__StreamMetadata_VorbisComment_Entry entry;
     char * comments, * comment, * end_of_comment;
 
-    /* FIXME This is never deleted; does it matter? */
-    metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
+    encoder->metadata = metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
 
     /* Check if there is a FIELD=value pair already in the comment; if not, add one */
     if (strchr(format->comment, '=') == NULL) 
@@ -448,6 +448,7 @@
   Encoder * encoder = (Encoder *) format->priv;
   FLAC__StreamEncoderState state = FLAC__stream_encoder_get_state(encoder->flac);
 
+  FLAC__metadata_object_delete(encoder->metadata);
   FLAC__stream_encoder_finish(encoder->flac);
   FLAC__stream_encoder_delete(encoder->flac);
   free(encoder->decoded_samples);