[Libav-user] Audio encoding using avcodec_fill_audio_frame() and memory leaks

Kalileo kalileo at universalx.net
Fri May 17 13:45:17 CEST 2013


On May 17, 2013, at 17:47 , Pradeep Karosiya wrote:

> Ok after successively disabling the code I found that memory leak is coming
> from av_interleaved_write_frame(), even though I'm using av_free_packet, it
> is still there.
> I tried to use av_destruct_packet just before av_free_packet but then my
> application is crashing while calling av_destruct_packet. 
> Actaully I'm setting mpkt.destruct to av_destruct_packet before calling
> av_interleaved_write_frame but 
> somehow mpkt.destruct is setting to NULL after the call of
> av_inteleaved_write_frame, so I'm setting it again before calling
> av_free_packet.
> Can someone explain the correct use to AVPacket.destruct and
> av_destruct_packet.
> 
> Thanks
> Pradeep
> 

I don't think you need to go the route of av_destruct_packet.

If you really see a leak, then try freeing the data in the packet before you run av_free_packet.





More information about the Libav-user mailing list