Answer the question
In order to leave comments, you need to log in
Help finding a memory leak
Memory leaks in functions:
static int xxxx_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct xxxx *xxxx = s->priv_data;
CFDataRef bitmapDataRef = CGDataProviderCopyData( CGImageGetDataProvider( xxxx->image ) );
uint8_t *imgData = (uint8_t *)CFDataGetBytePtr( bitmapDataRef );
av_init_packet( pkt );
pkt->data = imgData;
pkt->size = xxxx->frame_size;
pkt->pts = curtime;
CGImageRelease( xxxx->image );
//CFRelease( bitmapDataRef );
xxxx->image = CGWindowListCreateImage( CGRectInfinite, kCGWindowListOptionAll, kCGNullWindowID, kCGWindowImageDefault );
return xxxx->frame_size;
}
Answer the question
In order to leave comments, you need to log in
Here is a similar question: stackoverflow.com/questions/11992791/ios-potential-leak-of-data-cfdatagetbyteptr
There seems to be a similar situation. Copy the data, and then call CFRelease, which is now commented out for some reason.
av_free_packet(pkt) must be called if xxxx_read_packet is not called after calling xxxx_read_packet.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question