In the description for avcodec_free_frame, it states:

"Warning: this function does NOT free the data buffers themselves"

I have allocated my buffers as such:
int curAVFramesize = avpicture_get_size(PIX_FMT_YUV420P, ccontext->width,
ccontext->height);
uint8_t* curAVFramePicBuffer = (uint8_t*)(av_malloc(curAVFramesize));
AVFrame *curAVFrame=avcodec_alloc_frame();
avpicture_fill((AVPicture *)curAVFrame,curAVFramePicBuffer,
PIX_FMT_YUV420P,ccontext->width, ccontext->height);


I figured that the warning meant calling 'avpicture_free' was nessecary. So
I've been freeing it as:
avpicture_free((AVPicture *)curAVFrame);
avcodec_free_frame((AVFrame **)(&curAVFrame));

Usually my program doesn't complain but every once in a while, after
calling 'avpicture_free' but before 'avcodec_free_frame' it'll throw a heap
allocation error.

Here is the entire function: http://pastebin.com/jHecUySU

Is avpicture_free needed?  Any thoughts as to what might be happening?

Thank you!
Matt

-- 
Matt Czarnek, Software Engineer
Work Phone:  (760) 4-OBJVID
             aka:  (760) 462-5843

Cell Phone: HAHAHOORAY

ObjectVideo Inc.

http://www.objectvideo.com
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to