[FFmpeg-soc] [soc]: r757 - dirac/libavcodec/dirac.c

marco subversion at mplayerhq.hu
Tue Aug 14 02:38:40 CEST 2007


Author: marco
Date: Tue Aug 14 02:38:40 2007
New Revision: 757

Log:
in case of an error, free the memory

Modified:
   dirac/libavcodec/dirac.c

Modified: dirac/libavcodec/dirac.c
==============================================================================
--- dirac/libavcodec/dirac.c	(original)
+++ dirac/libavcodec/dirac.c	Tue Aug 14 02:38:40 2007
@@ -2368,6 +2368,7 @@ static int dirac_motion_compensation(AVC
         if (s->refframes[refidx2].halfpel[comp] == NULL) {
         s->ref2data = av_malloc(s->ref2width * s->ref2height);
         if (!s->ref2data) {
+            av_free(s->ref1data);
             av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
             return -1;
         }
@@ -2383,6 +2384,10 @@ static int dirac_motion_compensation(AVC
 
     mcpic = av_malloc(s->padded_width * s->height * sizeof(int16_t));
     if (!mcpic) {
+        av_free(s->ref1data);
+        if (s->refs == 2)
+            av_free(s->ref2data);
+
         av_log(avctx, AV_LOG_ERROR, "av_malloc() failed\n");
         return -1;
     }



More information about the FFmpeg-soc mailing list