diff mjpeg.c @ 396:fce0a2520551 libavcodec

removed useless header includes - use av memory functions
author glantau
date Sat, 18 May 2002 23:03:29 +0000
parents 749b5c16c0f7
children c058624083e1
line wrap: on
line diff
--- a/mjpeg.c	Sat May 18 23:01:20 2002 +0000
+++ b/mjpeg.c	Sat May 18 23:03:29 2002 +0000
@@ -23,10 +23,6 @@
 #include "avcodec.h"
 #include "dsputil.h"
 #include "mpegvideo.h"
-#include "common.h"
-
-#include <string.h>
-#include <stdio.h>
 
 #ifdef USE_FASTMEMCPY
 #include "fastmemcpy.h"
@@ -246,7 +242,7 @@
 {
     MJpegContext *m;
     
-    m = malloc(sizeof(MJpegContext));
+    m = av_malloc(sizeof(MJpegContext));
     if (!m)
         return -1;
     
@@ -278,7 +274,7 @@
 
 void mjpeg_close(MpegEncContext *s)
 {
-    free(s->mjpeg_ctx);
+    av_free(s->mjpeg_ctx);
 }
 
 static inline void put_marker(PutBitContext *p, int code)
@@ -777,10 +773,8 @@
     /* if different size, realloc/alloc picture */
     /* XXX: also check h_count and v_count */
     if (width != s->width || height != s->height) {
-        for(i=0;i<MAX_COMPONENTS;i++) {
-            free(s->current_picture[i]);
-            s->current_picture[i] = NULL;
-        }
+        for(i=0;i<MAX_COMPONENTS;i++)
+            av_freep(&s->current_picture[i]);
         s->width = width;
         s->height = height;
         /* test interlaced mode */
@@ -1128,7 +1122,7 @@
 
     /* XXX: verify len field validity */
     len = get_bits(&s->gb, 16)-2;
-    cbuf = malloc(len+1);
+    cbuf = av_malloc(len+1);
 
     for (i = 0; i < len; i++)
 	cbuf[i] = get_bits(&s->gb, 8);
@@ -1147,7 +1141,7 @@
 	    printf("mjpeg: workarounding buggy AVID\n");
     }
     
-    free(cbuf);
+    av_free(cbuf);
 
     return 0;
 }
@@ -1332,7 +1326,7 @@
     int i, j;
 
     for(i=0;i<MAX_COMPONENTS;i++)
-        free(s->current_picture[i]);
+        av_free(s->current_picture[i]);
     for(i=0;i<2;i++) {
         for(j=0;j<4;j++)
             free_vlc(&s->vlcs[i][j]);