diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-07-21 11:41:13 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-07-21 11:41:13 +0000 |
commit | 091d3bdc738c547ab4ccf1bc71f3e1f08343330e (patch) | |
tree | c432b5ecd9303ad2f2cf4d6f7a5f108f878052df | |
parent | 47b7382d2922e7f87131db4a7f20ba10359be798 (diff) | |
download | ffmpeg-091d3bdc738c547ab4ccf1bc71f3e1f08343330e.tar.gz |
fix memleak
Originally committed as revision 27332 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
-rw-r--r-- | libswscale/swscale.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c index a3a1831f67..ccdeae8185 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -932,6 +932,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF int minFilterSize; double *filter=NULL; double *filter2=NULL; + int ret= -1; #if defined(ARCH_X86) if (flags & SWS_CPU_CAPS_MMX) asm volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) @@ -1211,8 +1212,8 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1)); assert(filterSize > 0); filter= av_malloc(filterSize*dstW*sizeof(double)); - if (filterSize >= MAX_FILTER_SIZE) - return -1; + if (filterSize >= MAX_FILTER_SIZE || !filter) + goto error; *outFilterSize= filterSize; if (flags&SWS_PRINT_INFO) @@ -1228,7 +1229,6 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF else filter[i*filterSize + j]= filter2[i*filter2Size + j]; } } - av_freep(&filter2); //FIXME try to align filterpos if possible @@ -1296,8 +1296,11 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF (*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)]; } + ret=0; +error: av_free(filter); - return 0; + av_free(filter2); + return ret; } #ifdef COMPILE_MMX2 |