diff options
author | Max Kellermann <max@duempel.org> | 2010-05-31 09:33:43 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-05-31 09:35:49 +0200 |
commit | 51c7577c8fc32222a0a688a83e8bbdf6fbd85139 (patch) | |
tree | 1c4de3fed3571c78fdd6c5918673e17fbcad608f | |
parent | be308c6657152ad380f927f221730973c3430fa6 (diff) | |
download | mpd-51c7577c8fc32222a0a688a83e8bbdf6fbd85139.tar.gz mpd-51c7577c8fc32222a0a688a83e8bbdf6fbd85139.tar.xz mpd-51c7577c8fc32222a0a688a83e8bbdf6fbd85139.zip |
decoder/mp4ff: rename and move local variable
Allocate the "tag" object after the file has been checked. That
removes one tag_free() call in an error handler.
-rw-r--r-- | src/decoder/mp4ff_decoder_plugin.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/decoder/mp4ff_decoder_plugin.c b/src/decoder/mp4ff_decoder_plugin.c index 97184674e..920e9fd37 100644 --- a/src/decoder/mp4ff_decoder_plugin.c +++ b/src/decoder/mp4ff_decoder_plugin.c @@ -367,7 +367,6 @@ mp4ff_tag_name_parse(const char *name) static struct tag * mp4_stream_tag(struct input_stream *is) { - struct tag *ret = NULL; struct mp4ff_input_stream mis; int32_t track; int32_t file_time; @@ -384,15 +383,15 @@ mp4_stream_tag(struct input_stream *is) return NULL; } - ret = tag_new(); file_time = mp4ff_get_track_duration_use_offsets(mp4fh, track); scale = mp4ff_time_scale(mp4fh, track); if (scale < 0) { mp4ff_close(mp4fh); - tag_free(ret); return NULL; } - ret->time = ((float)file_time) / scale + 0.5; + + struct tag *tag = tag_new(); + tag->time = ((float)file_time) / scale + 0.5; for (i = 0; i < mp4ff_meta_get_num_items(mp4fh); i++) { char *item; @@ -402,7 +401,7 @@ mp4_stream_tag(struct input_stream *is) enum tag_type type = mp4ff_tag_name_parse(item); if (type != TAG_NUM_OF_ITEM_TYPES) - tag_add_item(ret, type, value); + tag_add_item(tag, type, value); free(item); free(value); @@ -410,7 +409,7 @@ mp4_stream_tag(struct input_stream *is) mp4ff_close(mp4fh); - return ret; + return tag; } static const char *const mp4_suffixes[] = { "m4a", "mp4", NULL }; |