[FFmpeg-cvslog] r17188 - trunk/libavformat/oggparsevorbis.c

jbr subversion
Thu Feb 12 22:39:37 CET 2009


Author: jbr
Date: Thu Feb 12 22:39:37 2009
New Revision: 17188

Log:
use av_malloc() in vorbis_comment()

Modified:
   trunk/libavformat/oggparsevorbis.c

Modified: trunk/libavformat/oggparsevorbis.c
==============================================================================
--- trunk/libavformat/oggparsevorbis.c	Thu Feb 12 18:52:05 2009	(r17187)
+++ trunk/libavformat/oggparsevorbis.c	Thu Feb 12 22:39:37 2009	(r17188)
@@ -71,8 +71,16 @@ vorbis_comment(AVFormatContext * as, uin
         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 @@ vorbis_comment(AVFormatContext * as, uin
             ct[vl] = 0;
 
             av_metadata_set(&as->metadata, tt, ct);
+
+            av_freep(&tt);
+            av_freep(&ct);
         }
     }
 




More information about the ffmpeg-cvslog mailing list