==290270== Memcheck, a memory error detector ==290270== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==290270== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info ==290270== Command: ./a.out ab ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x40123B: print_table (Y8M4maiF.c:65) ==290270== by 0x40249C: main (Y8M4maiF.c:587) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x4012FA: sort_table (Y8M4maiF.c:92) ==290270== by 0x4024A8: main (Y8M4maiF.c:588) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x401317: sort_table (Y8M4maiF.c:91) ==290270== by 0x4024A8: main (Y8M4maiF.c:588) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x401A59: create_huffman_tree (Y8M4maiF.c:276) ==290270== by 0x4024BA: main (Y8M4maiF.c:589) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x4025B0: main (Y8M4maiF.c:598) ==290270== ==290270== Invalid write of size 8 ==290270== at 0x401BCD: remove_last_node (Y8M4maiF.c:355) ==290270== by 0x401DB5: path_in_tree (Y8M4maiF.c:397) ==290270== by 0x401DA9: path_in_tree (Y8M4maiF.c:395) ==290270== by 0x401F38: convert_to_codes (Y8M4maiF.c:446) ==290270== by 0x4025C8: main (Y8M4maiF.c:604) ==290270== Address 0x4a3a2c8 is 0 bytes after a block of size 24 alloc'd ==290270== at 0x484086F: malloc (vg_replace_malloc.c:380) ==290270== by 0x401E83: convert_to_codes (Y8M4maiF.c:430) ==290270== by 0x4025C8: main (Y8M4maiF.c:604) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x40123B: print_table (Y8M4maiF.c:65) ==290270== by 0x4025E9: main (Y8M4maiF.c:608) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x402176: total_bits_encoded (Y8M4maiF.c:496) ==290270== by 0x4026CB: main (Y8M4maiF.c:617) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x402421: decode_len (Y8M4maiF.c:558) ==290270== by 0x40277A: main (Y8M4maiF.c:629) ==290270== ==290270== Conditional jump or move depends on uninitialised value(s) ==290270== at 0x4014FE: free_table (Y8M4maiF.c:150) ==290270== by 0x4027EA: main (Y8M4maiF.c:636) ==290270== character frequency a 1 b 1 total_nodes = 2 Tree Starts here--> root node Node = 0x4a3a120 total freq = 2 1 Node = 0x4a3a180 total freq = 1 letter = a 0 Node = 0x4a3a1e0 total freq = 1 letter = b codes letter = a codes letter = b num_nodes = 3 ************* print path for a cur = 2: 0x4a3a120 2 0x4a3a180 1 ************* code for letter a: 1 print path for a cur = 1: 0x4a3a120 2 0x4a3a180 1 ************* print path for b cur = 2: 0x4a3a120 2 0x4a3a1e0 0 ************* code for letter b: 0 print path for b cur = 1: 0x4a3a120 2 0x4a3a1e0 0 ab character frequency a 1 b 1 letter = a code =1 letter = b code =0 total bytes needed = 2 ab encoded to: 10 decoded string = ab ==290270== ==290270== HEAP SUMMARY: ==290270== in use at exit: 48 bytes in 2 blocks ==290270== total heap usage: 15 allocs, 13 frees, 4,309 bytes allocated ==290270== ==290270== LEAK SUMMARY: ==290270== definitely lost: 24 bytes in 1 blocks ==290270== indirectly lost: 24 bytes in 1 blocks ==290270== possibly lost: 0 bytes in 0 blocks ==290270== still reachable: 0 bytes in 0 blocks ==290270== suppressed: 0 bytes in 0 blocks ==290270== Rerun with --leak-check=full to see details of leaked memory ==290270== ==290270== Use --track-origins=yes to see where uninitialised values come from ==290270== For lists of detected and suppressed errors, rerun with: -s ==290270== ERROR SUMMARY: 10 errors from 10 contexts (suppressed: 0 from 0)