Opened 12 years ago

Closed 12 years ago

#2142 closed defect (fixed)

Memory leak in doc/examples/demuxing.c

Reported by: Angelo Haller Owned by:
Priority: normal Component: documentation
Version: git-master Keywords: leak
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

How to reproduce:

$ cd doc/examples
$ PKG_CONFIG_PATH=pc-uninstalled make
$ ./decoding_encoding mpg
$ valgrind ./demuxing test.mpg test.video test.audio
==20852== Memcheck, a memory error detector
==20852== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==20852== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==20852== Command: ./demuxing test.mpg test.video test.audio
==20852== 
[mpegvideo @ 0x68df080] Estimating duration from bitrate, this may be inaccurate
Could not find audio stream in input file 'test.mpg'
Input #0, mpegvideo, from 'test.mpg':
  Duration: 00:00:00.01, bitrate: 104862 kb/s
    Stream #0:0: Video: mpeg1video, yuv420p, 352x288 [SAR 1:1 DAR 11:9], 104857 kb/s, 25 fps, 25 tbr, 1200k tbn, 25 tbc
Demuxing video from file 'test.mpg' into 'test.video'
video_frame n:0 coded_n:0 pts:NOPTS
video_frame n:1 coded_n:2 pts:NOPTS
video_frame n:2 coded_n:1 pts:NOPTS
video_frame n:3 coded_n:4 pts:NOPTS
video_frame n:4 coded_n:3 pts:NOPTS
video_frame n:5 coded_n:6 pts:NOPTS
video_frame n:6 coded_n:5 pts:NOPTS
video_frame n:7 coded_n:8 pts:NOPTS
video_frame n:8 coded_n:7 pts:NOPTS
video_frame n:9 coded_n:10 pts:NOPTS
video_frame n:10 coded_n:9 pts:NOPTS
video_frame n:11 coded_n:12 pts:NOPTS
video_frame n:12 coded_n:11 pts:NOPTS
video_frame n:13 coded_n:14 pts:NOPTS
video_frame n:14 coded_n:13 pts:NOPTS
video_frame n:15 coded_n:16 pts:NOPTS
video_frame n:16 coded_n:15 pts:NOPTS
video_frame n:17 coded_n:18 pts:NOPTS
video_frame n:18 coded_n:17 pts:NOPTS
video_frame n:19 coded_n:20 pts:NOPTS
video_frame n:20 coded_n:19 pts:NOPTS
video_frame n:21 coded_n:22 pts:NOPTS
video_frame n:22 coded_n:21 pts:NOPTS
video_frame n:23 coded_n:24 pts:NOPTS
video_frame(cached) n:24 coded_n:23 pts:NOPTS
Demuxing succeeded.
Play the output video file with the command:
ffplay -f rawvideo -pix_fmt yuv420p -video_size 352x288 test.video
==20852== 
==20852== HEAP SUMMARY:
==20852==     in use at exit: 88,668 bytes in 25 blocks
==20852==   total heap usage: 327 allocs, 302 frees, 1,809,358 bytes allocated
==20852== 
==20852== LEAK SUMMARY:
==20852==    definitely lost: 88,668 bytes in 25 blocks
==20852==    indirectly lost: 0 bytes in 0 blocks
==20852==      possibly lost: 0 bytes in 0 blocks
==20852==    still reachable: 0 bytes in 0 blocks
==20852==         suppressed: 0 bytes in 0 blocks
==20852== Rerun with --leak-check=full to see details of leaked memory
==20852== 
==20852== For counts of detected and suppressed errors, rerun with: -v
==20852== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Change History (2)

comment:1 by Carl Eugen Hoyos, 12 years ago

Keywords: leak added

comment:2 by Stefano Sabatini, 12 years ago

Analyzed by developer: set
Reproduced by developer: set
Resolution: fixed
Status: newclosed

Fixed by the reporter, in commit:

commit e7a39e163ddbde85f966132194143d0338445a0c
Author: Angelo Haller <angelo@szanni.org>
Date:   Tue Jan 15 23:37:08 2013 +0100

    examples/demuxing: free AVPacket after usage
    
    Fix leak.

Thank you.

Note: See TracTickets for help on using tickets.