Commit 47b7382d authored by Michael Niedermayer's avatar Michael Niedermayer

Cleanup, use av_freep() instead of av_free(x); x=NULL

Originally committed as revision 27331 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
parent 582b3549
...@@ -1144,7 +1144,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1144,7 +1144,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
if (outVec != &scaleFilter) sws_freeVec(outVec); 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) */ /* 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). // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
...@@ -1228,7 +1228,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF ...@@ -1228,7 +1228,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
else filter[i*filterSize + j]= filter2[i*filter2Size + j]; else filter[i*filterSize + j]= filter2[i*filter2Size + j];
} }
} }
av_free(filter2); filter2=NULL; av_freep(&filter2);
//FIXME try to align filterpos if possible //FIXME try to align filterpos if possible
...@@ -2821,8 +2821,7 @@ void sws_printVec(SwsVector *a){ ...@@ -2821,8 +2821,7 @@ void sws_printVec(SwsVector *a){
void sws_freeVec(SwsVector *a){ void sws_freeVec(SwsVector *a){
if (!a) return; if (!a) return;
av_free(a->coeff); av_freep(&a->coeff);
a->coeff=NULL;
a->length=0; a->length=0;
av_free(a); av_free(a);
} }
...@@ -2845,48 +2844,30 @@ void sws_freeContext(SwsContext *c){ ...@@ -2845,48 +2844,30 @@ void sws_freeContext(SwsContext *c){
if (c->lumPixBuf) if (c->lumPixBuf)
{ {
for (i=0; i<c->vLumBufSize; i++) for (i=0; i<c->vLumBufSize; i++)
{ av_freep(&c->lumPixBuf[i]);
av_free(c->lumPixBuf[i]); av_freep(&c->lumPixBuf);
c->lumPixBuf[i]=NULL;
}
av_free(c->lumPixBuf);
c->lumPixBuf=NULL;
} }
if (c->chrPixBuf) if (c->chrPixBuf)
{ {
for (i=0; i<c->vChrBufSize; i++) for (i=0; i<c->vChrBufSize; i++)
{ av_freep(&c->chrPixBuf[i]);
av_free(c->chrPixBuf[i]); av_freep(&c->chrPixBuf);
c->chrPixBuf[i]=NULL;
}
av_free(c->chrPixBuf);
c->chrPixBuf=NULL;
} }
av_free(c->vLumFilter); av_freep(&c->vLumFilter);
c->vLumFilter = NULL; av_freep(&c->vChrFilter);
av_free(c->vChrFilter); av_freep(&c->hLumFilter);
c->vChrFilter = NULL; av_freep(&c->hChrFilter);
av_free(c->hLumFilter);
c->hLumFilter = NULL;
av_free(c->hChrFilter);
c->hChrFilter = NULL;
#ifdef HAVE_ALTIVEC #ifdef HAVE_ALTIVEC
av_free(c->vYCoeffsBank); av_freep(&c->vYCoeffsBank);
c->vYCoeffsBank = NULL; av_freep(&c->vCCoeffsBank);
av_free(c->vCCoeffsBank);
c->vCCoeffsBank = NULL;
#endif #endif
av_free(c->vLumFilterPos); av_freep(&c->vLumFilterPos);
c->vLumFilterPos = NULL; av_freep(&c->vChrFilterPos);
av_free(c->vChrFilterPos); av_freep(&c->hLumFilterPos);
c->vChrFilterPos = NULL; av_freep(&c->hChrFilterPos);
av_free(c->hLumFilterPos);
c->hLumFilterPos = NULL;
av_free(c->hChrFilterPos);
c->hChrFilterPos = NULL;
#if defined(ARCH_X86) && defined(CONFIG_GPL) #if defined(ARCH_X86) && defined(CONFIG_GPL)
#ifdef MAP_ANONYMOUS #ifdef MAP_ANONYMOUS
...@@ -2900,16 +2881,11 @@ void sws_freeContext(SwsContext *c){ ...@@ -2900,16 +2881,11 @@ void sws_freeContext(SwsContext *c){
c->funnyUVCode=NULL; c->funnyUVCode=NULL;
#endif /* defined(ARCH_X86) */ #endif /* defined(ARCH_X86) */
av_free(c->lumMmx2Filter); av_freep(&c->lumMmx2Filter);
c->lumMmx2Filter=NULL; av_freep(&c->chrMmx2Filter);
av_free(c->chrMmx2Filter); av_freep(&c->lumMmx2FilterPos);
c->chrMmx2Filter=NULL; av_freep(&c->chrMmx2FilterPos);
av_free(c->lumMmx2FilterPos); av_freep(&c->yuvTable);
c->lumMmx2FilterPos=NULL;
av_free(c->chrMmx2FilterPos);
c->chrMmx2FilterPos=NULL;
av_free(c->yuvTable);
c->yuvTable=NULL;
av_free(c); av_free(c);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment