Page 1 of 1

Problems with av_freep.

Posted: Fri Feb 10, 2012 6:15 am
by Vladimir
I was using av_freep() function across my project to free memory and zero pointers in one go.
However, sometimes, I was noticing very strange application crashes.
Output log contained very similar error messages saying something like "the application tried to modify memory 22 bytes beyond the heap pointer".
On these crashes, Visual Studio 2010 has shown the same assembly instructions and useless stack with a few addresses inside ntdll.dll.
Once or twice VS has pointed me to the source line with av_freep() call on these crashes.

I tried to replace these calls with

Code: Select all

av_free(pointer); 
pointer = NULL;
No more crashes.

What could they be related to?
Did anyone observe similar errors?

Re: Problems with av_freep.

Posted: Sat Feb 11, 2012 6:22 pm
by ramiro
are you passing a reference to the pointer to av_freep?

void *ptr;
av_freep(&ptr);

Re: Problems with av_freep.

Posted: Tue Feb 14, 2012 9:55 am
by Vladimir
Yes, of course.
It will not work otherwise.

I observed my crashes sometimes, and sometimes it worked smoothly.