aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-13 20:27:29 +0000
commit12ad66712a18d039eea73a742ae626b2376f8f4f (patch)
treef6d863c1a428480ad0366d48c44c8b89ef53b3e3 /libavformat/avidec.c
parentb8f11ec8878641f699c07b8425079d3611a51072 (diff)
downloadffmpeg-12ad66712a18d039eea73a742ae626b2376f8f4f.tar.gz
Use AV_METADATA_DONT_STRDUP* / use av_malloced metadata instead of strduped
arrays of fixed length. Code from ffmbc with changes to adapt to our metadata API. Originally committed as revision 20836 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 5be93949f7..6719c9d6e7 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -230,14 +230,19 @@ static void clean_index(AVFormatContext *s){
static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size)
{
ByteIOContext *pb = s->pb;
- uint8_t value[1024];
+ char *value;
- int64_t i = url_ftell(pb);
size += (size & 1);
- get_strz(pb, value, sizeof(value));
- url_fseek(pb, i+size, SEEK_SET);
- return av_metadata_set(&s->metadata, key, value);
+ if (size == UINT_MAX)
+ return -1;
+ value = av_malloc(size+1);
+ if (!value)
+ return -1;
+ get_strz(pb, value, size);
+
+ return av_metadata_set2(&s->metadata, key, value,
+ AV_METADATA_DONT_STRDUP_VAL);
}
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)