Notes
This function is in beta test. Please help improve it in the issues
here.
$ ./l5_memory_check rand_char*.txt dec ================================================================= ==9933==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000000a80 at pc 0x0000004b2327 bp 0x7ffde57fa4d0 sp 0x7ffde57f9c80 READ of size 2 at 0x61d000000a80 thread T0 #0 0x4b2326 (/out/package/l5_memory_check+0x4b2326) #1 0x515392 (/out/package/l5_memory_check+0x515392) #2 0x5179c0 (/out/package/l5_memory_check+0x5179c0) #3 0x517b49 (/out/package/l5_memory_check+0x517b49) #4 0x7efe12fdbb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #5 0x41ca39 (/out/package/l5_memory_check+0x41ca39) 0x61d000000a80 is located 0 bytes inside of 2048-byte region [0x61d000000a80,0x61d000001280) freed by thread T0 here: #0 0x4dc720 (/out/package/l5_memory_check+0x4dc720) #1 0x517909 (/out/package/l5_memory_check+0x517909) #2 0x517b49 (/out/package/l5_memory_check+0x517b49) #3 0x7efe12fdbb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by thread T0
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
Program exit with non zero value 1!
JOJ Answer
Correct!