diff options
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/flac_metadata.c | 7 | ||||
-rw-r--r-- | src/decoder/mad_decoder_plugin.c | 4 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/decoder/flac_metadata.c b/src/decoder/flac_metadata.c index 68d15f6d4..f2f2f954d 100644 --- a/src/decoder/flac_metadata.c +++ b/src/decoder/flac_metadata.c @@ -87,7 +87,7 @@ flac_find_string_comment(const FLAC__StreamMetadata *block, int offset; size_t pos; int len; - unsigned char tmp, *p; + const unsigned char *p; *str = NULL; offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, @@ -101,10 +101,7 @@ flac_find_string_comment(const FLAC__StreamMetadata *block, return false; p = &block->data.vorbis_comment.comments[offset].entry[pos]; - tmp = p[len]; - p[len] = '\0'; - *str = strdup((char *)p); - p[len] = tmp; + *str = g_strndup((const char *)p, len); return true; } diff --git a/src/decoder/mad_decoder_plugin.c b/src/decoder/mad_decoder_plugin.c index 5aa09b336..a11d1b020 100644 --- a/src/decoder/mad_decoder_plugin.c +++ b/src/decoder/mad_decoder_plugin.c @@ -285,10 +285,10 @@ parse_id3_mixramp(char **mixramp_start, char **mixramp_end, (&frame->fields[2])); if (g_ascii_strcasecmp(key, "mixramp_start") == 0) { - *mixramp_start = strdup(value); + *mixramp_start = g_strdup(value); found = true; } else if (g_ascii_strcasecmp(key, "mixramp_end") == 0) { - *mixramp_end = strdup(value); + *mixramp_end = g_strdup(value); found = true; } |