decoder_api: moved code to do_send_tag(), free temporary tag
This patch fixes a minor memory leak: when decoder_tag() attempted to send a merged tag object (created by tag_add_stream_tags()), and was interrupted by a decoder command, it did not free the temporary merged tag object.
This commit is contained in:
parent
77b32addf1
commit
149f4e10cf
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ ver 0.15 - (200?/??/??)
|
||||||
* support logging to syslog
|
* support logging to syslog
|
||||||
* fall back to XDG music directory if no music_directory is configured
|
* fall back to XDG music directory if no music_directory is configured
|
||||||
* failure to read the state file is non-fatal
|
* failure to read the state file is non-fatal
|
||||||
|
* fix minor memory leak in decoder_tag()
|
||||||
|
|
||||||
ver 0.14 (2008/12/25)
|
ver 0.14 (2008/12/25)
|
||||||
* audio outputs:
|
* audio outputs:
|
||||||
|
|
|
@ -183,6 +183,18 @@ need_chunks(struct input_stream *is, bool wait)
|
||||||
return DECODE_COMMAND_NONE;
|
return DECODE_COMMAND_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum decoder_command
|
||||||
|
do_send_tag(struct input_stream *is, const struct tag *tag)
|
||||||
|
{
|
||||||
|
while (!music_pipe_tag(tag)) {
|
||||||
|
enum decoder_command cmd = need_chunks(is, true);
|
||||||
|
if (cmd != DECODE_COMMAND_NONE)
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DECODE_COMMAND_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
enum decoder_command
|
enum decoder_command
|
||||||
decoder_data(struct decoder *decoder,
|
decoder_data(struct decoder *decoder,
|
||||||
struct input_stream *is,
|
struct input_stream *is,
|
||||||
|
@ -288,22 +300,20 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, struct input_stream *is,
|
||||||
const struct tag *tag)
|
const struct tag *tag)
|
||||||
{
|
{
|
||||||
struct tag *tag2 = is != NULL ? tag_add_stream_tags(tag, is) : NULL;
|
struct tag *tag2 = is != NULL ? tag_add_stream_tags(tag, is) : NULL;
|
||||||
|
enum decoder_command cmd;
|
||||||
|
|
||||||
assert(dc.state == DECODE_STATE_DECODE);
|
assert(dc.state == DECODE_STATE_DECODE);
|
||||||
|
|
||||||
if (tag2 != NULL)
|
if (tag2 != NULL)
|
||||||
tag = tag2;
|
tag = tag2;
|
||||||
|
|
||||||
while (!music_pipe_tag(tag)) {
|
cmd = do_send_tag(is, tag);
|
||||||
enum decoder_command cmd = need_chunks(is, true);
|
|
||||||
if (cmd != DECODE_COMMAND_NONE)
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tag2 != NULL)
|
if (tag2 != NULL)
|
||||||
tag_free(tag2);
|
tag_free(tag2);
|
||||||
|
|
||||||
|
if (cmd == DECODE_COMMAND_NONE)
|
||||||
decoder->stream_tag_sent = true;
|
decoder->stream_tag_sent = true;
|
||||||
|
|
||||||
return DECODE_COMMAND_NONE;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue