[Libav-user] muxing.c, memory leak

Denis info at denisgottardello.it
Sun Nov 4 16:48:44 CET 2012


In data domenica 04 novembre 2012 14:26:56, Carl Eugen Hoyos ha scritto:
> > Using valgrind I obtain a memory leak in this row:
> > 
> >
> > "pAVStream= add_video_stream(pAVFormatContext, &pAVCodec, 
> > pAVOutputFormat->video_codec);"
> > if (posix_memalign(&ptr,ALIGN,size))
> > av_mallocz in mem.c:95
> 
> Could you post the valgrind output?

4 bytes in 1 blocks are definitely lost in loss record 1 of 6
  in muxing(char const*) in main.cpp:275
  1: malloc in /tmp/buildd/valgrind-3.6.0~svn11254+nmu1/coregrind/m_replacemalloc/vg_replace_malloc.c:236
  2: realloc in /tmp/buildd/valgrind-3.6.0~svn11254+nmu1/coregrind/m_replacemalloc/vg_replace_malloc.c:525
  3: avformat_new_stream in <a href="file:///home/denis/C++/ffmpeg-1.0/libavformat/utils.c:3138" 
>/home/denis/C++/ffmpeg-1.0/libavformat/utils.c:3138</a>
  4: muxing(char const*) in <a href="file:///home/denis/C++/QtFFmpeg/QtFFmpegEncoder/C/C-build-desktop/../C/main.cpp:275" >main.cpp:275</a>
  5: main in <a href="file:///home/denis/C++/QtFFmpeg/QtFFmpegEncoder/C/C-build-desktop/../C/main.cpp:324" >main.cpp:324</a>


The row 275 is below:

pAVStream= add_video_stream(pAVFormatContext, &pAVCodec, pAVOutputFormat->video_codec);

that has the correspondent row

	close_video(pAVFormatContext, pAVStream);
        for (int count= 0; count< pAVFormatContext->nb_streams; count++) {
            av_freep(&pAVFormatContext->streams[count]->codec);
            av_freep(&pAVFormatContext->streams[count]);
	}
     if (!(pAVOutputFormat->flags & AVFMT_NOFILE))avio_close(pAVFormatContext->pb);
	//av_free(pAVFormatContext);
	avformat_free_context(pAVFormatContext);




but valgrind says detects memory leak.


-- 
www.denisgottardello.it
Skype: mrdebug
Videosurveillance and home automation! 
http://www.denisgottardello.it/DomusBoss/DomusBossIndice.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121104/89091bc6/attachment.html>


More information about the Libav-user mailing list