aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2006-06-21 16:11:07 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2006-06-21 16:11:07 +0000
commitc6dbba6c5dc37ecb79195bb515beeffdb0e380a6 (patch)
treedacadc7739ad6b07df962509d72b14152abfcc14 /src/inputPlugins
parentbdf4107117ea6b0e166c1be3ef270f631403a154 (diff)
downloadmpd-c6dbba6c5dc37ecb79195bb515beeffdb0e380a6.tar.gz
mpd-c6dbba6c5dc37ecb79195bb515beeffdb0e380a6.tar.xz
mpd-c6dbba6c5dc37ecb79195bb515beeffdb0e380a6.zip
Cleanup mp3_parseId3Tag to only modify the MpdTag if we have something new to replace it with.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4278 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins')
-rw-r--r--src/inputPlugins/mp3_plugin.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index 79215bcd9..30d1cfe02 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -260,8 +260,7 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
id3_length_t count;
id3_byte_t const *id3_data;
id3_byte_t * allocated = NULL;
-
- if(mpdTag) *mpdTag = NULL;
+ MpdTag * newMpdTag;
count = data->stream.bufend - data->stream.this_frame;
@@ -298,13 +297,18 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, MpdTag **
}
id3Tag = id3_tag_parse(id3_data, tagsize);
-
- if(id3Tag) {
- if(mpdTag) *mpdTag = parseId3Tag(id3Tag);
- if(replayGainInfo) mp3_getReplayGainInfo(id3Tag, replayGainInfo);
- id3_tag_delete(id3Tag);
+ if(!id3Tag) goto fail;
+
+ if(mpdTag) {
+ newMpdTag = parseId3Tag(id3Tag);
+ if(newMpdTag) {
+ if(*mpdTag) freeMpdTag(*mpdTag);
+ *mpdTag = newMpdTag;
+ }
}
+ if(replayGainInfo) mp3_getReplayGainInfo(id3Tag, replayGainInfo);
+ id3_tag_delete(id3Tag);
fail:
if(allocated) free(allocated);
}