#376 memory leaks

1.3.0
open-works-for-me
Erik
libFLAC (57)
9
2014-03-21
2011-03-07
Anonymous
No

when encoding OggFLAC using libFLAC, calling FLAC__stream_encoder_finish() causes memory leaks.
if i don't call this function, no memory leaks occur.

number of those memory leaks depend on whether any metadata are created (don't even have to be added using FLAC__stream_encoder_set_metadata() to cause memory leaks!!!) and whether any samples are encoded (whether FLAC__stream_encoder_process() is called).

i'm using flac-1.2.1

Is this a known issue? I can provide test case, if needed.

example memory leaks:
DEBUG: output from _CrtDumpMemoryLeaks() for LibOggEncoder.dll:
Detected memory leaks!
Dumping objects ->
{183} normal block at 0x01F54318, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{182} normal block at 0x01F541E8, 256 bytes long.
Data: < > 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00
{181} normal block at 0x01F540B8, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{180} normal block at 0x01F53F88, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{175} normal block at 0x01F73048, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{174} normal block at 0x01F72F18, 256 bytes long.
Data: < > 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00
{173} normal block at 0x01F569A8, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{172} normal block at 0x01F56878, 256 bytes long.
Data: < > 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00
{171} normal block at 0x01F56748, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{170} normal block at 0x01F56618, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{169} normal block at 0x01F564E8, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{168} normal block at 0x01F563B8, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{167} normal block at 0x01F56288, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{166} normal block at 0x01F56158, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{165} normal block at 0x01F56028, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{164} normal block at 0x01DCFE50, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 06 00 00 00 05 00 00 00
{163} normal block at 0x01DCFD20, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{162} normal block at 0x01DCFBF0, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{161} normal block at 0x01DCFAC0, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{160} normal block at 0x01DCF990, 256 bytes long.
Data: < > 06 00 00 00 06 00 00 00 05 00 00 00 05 00 00 00
{159} normal block at 0x01DCF860, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{158} normal block at 0x01F4BDE8, 256 bytes long.
Data: < > 04 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00
{157} normal block at 0x01F4BCB8, 256 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{156} normal block at 0x01F4BB88, 256 bytes long.
Data: < > 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00
{154} normal block at 0x01F37258, 32768 bytes long.
Data: <_ > 5F 09 00 00 07 0B 00 00 D7 07 00 00 B3 F8 FF FF
{146} normal block at 0x01DCF7F0, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{145} normal block at 0x01DCF760, 96 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{144} normal block at 0x01F472E8, 6160 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{143} normal block at 0x01DCF538, 504 bytes long.
Data: < > 09 00 00 00 02 00 00 00 01 00 00 00 10 00 00 00
{142} normal block at 0x01DCF500, 8 bytes long.
Data: <8 r > 38 F5 DC 01 E8 72 F4 01
{117} normal block at 0x01DCA438, 56 bytes long.
Data: < P > 0E 00 00 00 50 A2 DC 01 14 00 00 00 C8 A2 DC 01
{116} normal block at 0x01DCA3E8, 30 bytes long.
Data: <GENRE=Drum & Bas> 47 45 4E 52 45 3D 44 72 75 6D 20 26 20 42 61 73
{113} normal block at 0x01DCA310, 16 bytes long.
Data: <TRACKNUMBER=1/4 > 54 52 41 43 4B 4E 55 4D 42 45 52 3D 31 2F 34 00
{110} normal block at 0x01DCA290, 10 bytes long.
Data: <DATE=1999 > 44 41 54 45 3D 31 39 39 39 00
{107} normal block at 0x01DCA350, 15 bytes long.
Data: <ALBUM=Distroia > 41 4C 42 55 4D 3D 44 69 73 74 72 6F 69 61 00
{104} normal block at 0x01DCA2C8, 21 bytes long.
Data: <ARTIST=Mouse on > 41 52 54 49 53 54 3D 4D 6F 75 73 65 20 6F 6E 20
{101} normal block at 0x01DCA250, 15 bytes long.
Data: <TITLE=Distroia > 54 49 54 4C 45 3D 44 69 73 74 72 6F 69 61 00
{98} normal block at 0x01DCA200, 33 bytes long.
Data: <reference libFLA> 72 65 66 65 72 65 6E 63 65 20 6C 69 62 46 4C 41
{97} normal block at 0x01DCA120, 176 bytes long.
Data: < > 04 00 00 00 01 00 00 00 FA BE 00 00 00 00 00 00
{96} normal block at 0x01DCA0F0, 4 bytes long.
Data: < > 20 A1 DC 01
{118} normal block at 0x01EE0068, 48722 bytes long.
Data: <METADATA_BLOCK_P> 4D 45 54 41 44 41 54 41 5F 42 4C 4F 43 4B 5F 50
{92} normal block at 0x01DC3B50, 60 bytes long.
Data: < imag> 03 00 00 00 00 00 00 00 CD CD CD CD 69 6D 61 67
{85} normal block at 0x01DC9F78, 32 bytes long.
Data: <Drum & Bass, Ele> 44 72 75 6D 20 26 20 42 61 73 73 2C 20 45 6C 65
{83} normal block at 0x01DC9FE8, 216 bytes long.
Data: < Dist> 0F 00 00 00 00 00 00 00 CD CD CD CD 44 69 73 74
{74} normal block at 0x01DC3B10, 20 bytes long.
Data: < 5 > 00 00 00 00 97 35 00 00 00 00 00 00 00 00 00 00
{73} normal block at 0x01DC70B0, 11848 bytes long.
Data: < X / > 00 10 00 00 58 EF EE 01 98 2F EF 01 00 00 00 00
{72} normal block at 0x01DC6D78, 776 bytes long.
Data: < > 05 00 00 00 00 00 00 00 01 00 00 00 01 00 00 00
{71} normal block at 0x01DC3AD8, 8 bytes long.
Data: <xm p > 78 6D DC 01 B0 70 DC 01
{70} normal block at 0x01DC2C58, 3664 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{69} normal block at 0x01DC2920, 776 bytes long.
Data: < > 06 00 00 00 02 00 00 00 00 00 00 00 CD CD CD CD
Object dump complete.

Discussion


  • Anonymous
    2011-03-07

    • priority: 5 --> 9
     
  • Erik
    Erik
    2014-03-21

    The problem is almost certainly in your code. The flac binary does indeed call FLAC__stream_encoder_finish() and when tested on Linux under Valgrind reports zero memory leaks.

     
  • Erik
    Erik
    2014-03-21

    • status: open --> open-works-for-me
    • assigned_to: Erik
    • Group: --> 1.3.0