# HG changeset patch # User michael # Date 1216639104 0 # Node ID 4e57d47ee5db5199ce1e749a19aead18a53a2bf5 # Parent 0de5b595d2aebbeddf53df791f142562a1138edb Cleanup, use av_freep() instead of av_free(x); x=NULL diff -r 0de5b595d2ae -r 4e57d47ee5db libswscale/swscale.c --- a/libswscale/swscale.c Sat Jul 19 11:32:33 2008 +0000 +++ b/libswscale/swscale.c Mon Jul 21 11:18:24 2008 +0000 @@ -1144,7 +1144,7 @@ if (outVec != &scaleFilter) sws_freeVec(outVec); } - av_free(filter); filter=NULL; + av_freep(&filter); /* try to reduce the filter-size (step1 find size and shift left) */ // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not). @@ -1228,7 +1228,7 @@ else filter[i*filterSize + j]= filter2[i*filter2Size + j]; } } - av_free(filter2); filter2=NULL; + av_freep(&filter2); //FIXME try to align filterpos if possible @@ -2821,8 +2821,7 @@ void sws_freeVec(SwsVector *a){ if (!a) return; - av_free(a->coeff); - a->coeff=NULL; + av_freep(&a->coeff); a->length=0; av_free(a); } @@ -2845,48 +2844,30 @@ if (c->lumPixBuf) { for (i=0; ivLumBufSize; i++) - { - av_free(c->lumPixBuf[i]); - c->lumPixBuf[i]=NULL; - } - av_free(c->lumPixBuf); - c->lumPixBuf=NULL; + av_freep(&c->lumPixBuf[i]); + av_freep(&c->lumPixBuf); } if (c->chrPixBuf) { for (i=0; ivChrBufSize; i++) - { - av_free(c->chrPixBuf[i]); - c->chrPixBuf[i]=NULL; - } - av_free(c->chrPixBuf); - c->chrPixBuf=NULL; + av_freep(&c->chrPixBuf[i]); + av_freep(&c->chrPixBuf); } - av_free(c->vLumFilter); - c->vLumFilter = NULL; - av_free(c->vChrFilter); - c->vChrFilter = NULL; - av_free(c->hLumFilter); - c->hLumFilter = NULL; - av_free(c->hChrFilter); - c->hChrFilter = NULL; + av_freep(&c->vLumFilter); + av_freep(&c->vChrFilter); + av_freep(&c->hLumFilter); + av_freep(&c->hChrFilter); #ifdef HAVE_ALTIVEC - av_free(c->vYCoeffsBank); - c->vYCoeffsBank = NULL; - av_free(c->vCCoeffsBank); - c->vCCoeffsBank = NULL; + av_freep(&c->vYCoeffsBank); + av_freep(&c->vCCoeffsBank); #endif - av_free(c->vLumFilterPos); - c->vLumFilterPos = NULL; - av_free(c->vChrFilterPos); - c->vChrFilterPos = NULL; - av_free(c->hLumFilterPos); - c->hLumFilterPos = NULL; - av_free(c->hChrFilterPos); - c->hChrFilterPos = NULL; + av_freep(&c->vLumFilterPos); + av_freep(&c->vChrFilterPos); + av_freep(&c->hLumFilterPos); + av_freep(&c->hChrFilterPos); #if defined(ARCH_X86) && defined(CONFIG_GPL) #ifdef MAP_ANONYMOUS @@ -2900,16 +2881,11 @@ c->funnyUVCode=NULL; #endif /* defined(ARCH_X86) */ - av_free(c->lumMmx2Filter); - c->lumMmx2Filter=NULL; - av_free(c->chrMmx2Filter); - c->chrMmx2Filter=NULL; - av_free(c->lumMmx2FilterPos); - c->lumMmx2FilterPos=NULL; - av_free(c->chrMmx2FilterPos); - c->chrMmx2FilterPos=NULL; - av_free(c->yuvTable); - c->yuvTable=NULL; + av_freep(&c->lumMmx2Filter); + av_freep(&c->chrMmx2Filter); + av_freep(&c->lumMmx2FilterPos); + av_freep(&c->chrMmx2FilterPos); + av_freep(&c->yuvTable); av_free(c); }