[FFmpeg-devel] [PATCH] remove memory leak from tools/pktdumper.c

Michael Niedermayer michaelni
Thu Apr 30 12:33:03 CEST 2009


On Thu, Apr 30, 2009 at 12:25:13PM +0200, Zdenek Kabelac wrote:
> 2009/4/30 Michael Niedermayer <michaelni at gmx.at>:
> > On Thu, Apr 30, 2009 at 11:44:49AM +0200, Zdenek Kabelac wrote:
> >> Hi
> >>
> >> This small patch should adapt probably not often used
> >> tools/pktdumper.c application to use newer packet reading API.
> >> (So machines with small memory should be able to dump even very large streams)
> >>
> >> It should fix these valgrind errors:
> >>
> >> ==4997== 21,528 bytes in 1 blocks are indirectly lost in loss record 1 of 4
> >> ==4997== ? ?at 0x4C2576F: realloc (vg_replace_malloc.c:429)
> >> ==4997== ? ?by 0x483138: av_fast_realloc (utils.c:76)
> >> ==4997== ? ?by 0x40778C: av_add_index_entry.clone.4 (utils.c:1172)
> >> ==4997== ? ?by 0x40ABFC: av_read_frame_internal (utils.c:931)
> >> ==4997== ? ?by 0x4039AB: main (pktdumper.c:100)
> >> ==4997==
> >> ==4997==
> >> ==4997== 36,648 bytes in 7 blocks are indirectly lost in loss record 2 of 4
> >> ==4997== ? ?at 0x4C23260: memalign (vg_replace_malloc.c:460)
> >> ==4997== ? ?by 0x4C23317: posix_memalign (vg_replace_malloc.c:569)
> >> ==4997== ? ?by 0x8BECA7: av_malloc (mem.c:66)
> >> ==4997== ? ?by 0x40D58C: url_open_protocol (avio.c:76)
> >> ==4997== ? ?by 0x40D748: url_open (avio.c:136)
> >> ==4997== ? ?by 0x40EB00: url_fopen (aviobuf.c:603)
> >> ==4997== ? ?by 0x409108: av_open_input_file (utils.c:449)
> >> ==4997== ? ?by 0x40383F: main (pktdumper.c:86)
> >> ==4997==
> >> ==4997==
> >> ==4997== 125,256 (67,080 direct, 58,176 indirect) bytes in 130 blocks
> >> are definitely lost in loss record 3 of 4
> >> ==4997== ? ?at 0x4C23260: memalign (vg_replace_malloc.c:460)
> >> ==4997== ? ?by 0x4C23317: posix_memalign (vg_replace_malloc.c:569)
> >> ==4997== ? ?by 0x8BECA7: av_malloc (mem.c:66)
> >> ==4997== ? ?by 0x47A227: avformat_alloc_context (options.c:80)
> >> ==4997== ? ?by 0x4072A4: av_open_input_stream (utils.c:364)
> >> ==4997== ? ?by 0x409294: av_open_input_file (utils.c:489)
> >> ==4997== ? ?by 0x40383F: main (pktdumper.c:86)
> >> ==4997==
> >>
> >>
> >> --------
> >>
> >> Index: tools/pktdumper.c
> >> ===================================================================
> >> --- tools/pktdumper.c ? (revision 18717)
> >> +++ tools/pktdumper.c ? (working copy)
> >> @@ -95,8 +95,6 @@
> >> ? ? ? ? ?return 1;
> >> ? ? ?}
> >>
> >> - ? ?av_init_packet(&pkt);
> >> -
> >
> > unrelated change
> 
> Hmm - missed this line

no problem, you missed just one out of 2 lines

[...]

>  pktdumper.c |    3 +++
>  1 file changed, 3 insertions(+)
> 8a843d4a196e7767c2e28146342628e0442eacab  patch_pkt.diff

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090430/5f8db866/attachment.pgp>



More information about the ffmpeg-devel mailing list