Problems with av_freep.

For the developers that use FFmpeg in their software.
Post Reply
Vladimir
Posts: 29
Joined: Tue Sep 27, 2011 1:15 pm

Problems with av_freep.

Post by Vladimir » Fri Feb 10, 2012 6:15 am

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?

ramiro
Posts: 157
Joined: Tue May 10, 2011 12:56 am

Re: Problems with av_freep.

Post by ramiro » Sat Feb 11, 2012 6:22 pm

are you passing a reference to the pointer to av_freep?

void *ptr;
av_freep(&ptr);

Vladimir
Posts: 29
Joined: Tue Sep 27, 2011 1:15 pm

Re: Problems with av_freep.

Post by Vladimir » Tue Feb 14, 2012 9:55 am

Yes, of course.
It will not work otherwise.

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

Post Reply
'