changeset 3159:e1157712c1d5 libavcodec

fix segfault with BLUR8.AVI
author michael
date Fri, 03 Mar 2006 20:36:08 +0000
parents 5b2a0e54dfa7
children 25f6245381be
files utils.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Thu Mar 02 21:47:53 2006 +0000
+++ b/utils.c	Fri Mar 03 20:36:08 2006 +0000
@@ -844,9 +844,6 @@
     if(avctx->codec)
         goto end;
 
-    avctx->codec = codec;
-    avctx->codec_id = codec->id;
-    avctx->frame_number = 0;
     if (codec->priv_data_size > 0) {
         avctx->priv_data = av_mallocz(codec->priv_data_size);
         if (!avctx->priv_data)
@@ -865,9 +862,13 @@
         goto end;
     }
 
+    avctx->codec = codec;
+    avctx->codec_id = codec->id;
+    avctx->frame_number = 0;
     ret = avctx->codec->init(avctx);
     if (ret < 0) {
         av_freep(&avctx->priv_data);
+        avctx->codec= NULL;
         goto end;
     }
     ret=0;