aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_metadata.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-09-23 08:49:21 +0200
committerMax Kellermann <max@duempel.org>2010-09-23 08:49:21 +0200
commit635cfbae131b323b62ca50c6bffb0b801b57aafe (patch)
tree6a587c6b95ea79d64694f08efa74c86304f91639 /src/decoder/flac_metadata.c
parent922e51e8a94de09ceec37bc6d26a0802de2e75d7 (diff)
downloadmpd-635cfbae131b323b62ca50c6bffb0b801b57aafe.tar.gz
mpd-635cfbae131b323b62ca50c6bffb0b801b57aafe.tar.xz
mpd-635cfbae131b323b62ca50c6bffb0b801b57aafe.zip
decoder_control: use g_free() to manage mixramp allocations
Be consistent with the rest of MPD, and don't use the non-portable header "malloc.h".
Diffstat (limited to 'src/decoder/flac_metadata.c')
-rw-r--r--src/decoder/flac_metadata.c7
1 files changed, 2 insertions, 5 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;
}