Mercurial > libavformat.hg
changeset 4466:ad9324c36a3f libavformat
use av_malloc() in vorbis_comment()
author | jbr |
---|---|
date | Thu, 12 Feb 2009 21:39:37 +0000 |
parents | 042e9a2fdda2 |
children | 1dae64d3a6ff |
files | oggparsevorbis.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/oggparsevorbis.c Thu Feb 12 17:26:06 2009 +0000 +++ b/oggparsevorbis.c Thu Feb 12 21:39:37 2009 +0000 @@ -71,8 +71,16 @@ v++; if (tl && vl) { - char tt[tl + 1]; - char ct[vl + 1]; + char *tt, *ct; + + tt = av_malloc(tl + 1); + ct = av_malloc(vl + 1); + if (!tt || !ct) { + av_freep(&tt); + av_freep(&ct); + av_log(as, AV_LOG_WARNING, "out-of-memory error. skipping VorbisComment tag.\n"); + continue; + } for (j = 0; j < tl; j++) tt[j] = toupper(t[j]); @@ -82,6 +90,9 @@ ct[vl] = 0; av_metadata_set(&as->metadata, tt, ct); + + av_freep(&tt); + av_freep(&ct); } }