Here are some possible patches for speexfile.cpp:
This patch enables reading of comments for files with only one comment field:
CODE
-641 if ( nb_fields > 1 ) {
+641 if ( nb_fields > 0 ) {
+641 if ( nb_fields > 0 ) {
This patch fixes some memory leaks which are based on subsequent calls to ogg_stream_init in line 763:
CODE
-814 init = false;
+814 if (init) ogg_stream_clear ( &os );
init = false;
+814 if (init) ogg_stream_clear ( &os );
init = false;
This part is not necessary and will result in a memory leak at 656 (after applying path 1):
CODE
-592 stream[streamcount-1]->tags[stream[streamcount-1]->tagcount] = (speextags *)calloc ( 1, sizeof (speextags) );
-593 if ( stream[streamcount-1]->tags[stream[streamcount-1]->tagcount] == NULL ) {
-594 strcpy ( speex_last_error, "Memory allocation failed" );
-595 return -1;
-596 }
-593 if ( stream[streamcount-1]->tags[stream[streamcount-1]->tagcount] == NULL ) {
-594 strcpy ( speex_last_error, "Memory allocation failed" );
-595 return -1;
-596 }
Memory leak fix for speexfile::stream_free_tags
CODE
-715 }
+715 if (stream[_stream]->tags[i]!=NULL)
{
::free(stream[_stream]->tags[i]);
stream[_stream]->tags[i]= NULL;
}
}
+715 if (stream[_stream]->tags[i]!=NULL)
{
::free(stream[_stream]->tags[i]);
stream[_stream]->tags[i]= NULL;
}
}
Case, it would be nice, if you could verify my thoughts.
~ Florian