Return AVERROR(ENOMEM) on memory allocation failure of avcodec_open.
authorPanagiotis Issaris <takis.issaris@uhasselt.be>
Fri, 20 Jul 2007 15:08:10 +0000 (15:08 +0000)
committerPanagiotis Issaris <takis.issaris@uhasselt.be>
Fri, 20 Jul 2007 15:08:10 +0000 (15:08 +0000)
Originally committed as revision 9769 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/utils.c

index f5f9f2f..cd7bc1c 100644 (file)
@@ -832,8 +832,10 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
 
     if (codec->priv_data_size > 0) {
         avctx->priv_data = av_mallocz(codec->priv_data_size);
-        if (!avctx->priv_data)
+        if (!avctx->priv_data) {
+            ret = AVERROR(ENOMEM);
             goto end;
+        }
     } else {
         avctx->priv_data = NULL;
     }