Memory leak fix patch by (Burkhard Plaum <plaum >at< ipf.uni-stuttgart )dot( de>)
Originally committed as revision 3717 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:

committed by
Michael Niedermayer

parent
8a6cb11455
commit
073c2593c9
@@ -89,6 +89,26 @@ void *av_mallocz_static(unsigned int size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* same as above, but does realloc
|
||||
*/
|
||||
|
||||
void *av_realloc_static(void *ptr, unsigned int size)
|
||||
{
|
||||
int i;
|
||||
if(!ptr)
|
||||
return av_mallocz_static(size);
|
||||
/* Look for the old ptr */
|
||||
for(i = 0; i < last_static; i++) {
|
||||
if(array_static[i] == ptr) {
|
||||
array_static[i] = av_realloc(array_static[i], size);
|
||||
return array_static[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* free all static arrays and reset pointers to 0.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user