Notes
This function is in beta test. Please help improve it in the issues
here.
$ ./l5_memory_check rand_double.txt dec ================================================================= ==3668==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000000018 at pc 0x000000517866 bp 0x7fff20c29850 sp 0x7fff20c29848 WRITE of size 4 at 0x602000000018 thread T0 #0 0x517865 (/out/package/l5_memory_check+0x517865) #1 0x518a4e (/out/package/l5_memory_check+0x518a4e) #2 0x518bc9 (/out/package/l5_memory_check+0x518bc9) #3 0x7f597170db96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #4 0x41ca29 (/out/package/l5_memory_check+0x41ca29) 0x602000000018 is located 8 bytes inside of 16-byte region [0x602000000010,0x602000000020) freed by thread T0 here: #0 0x4dc710 (/out/package/l5_memory_check+0x4dc710) #1 0x5172cb (/out/package/l5_memory_check+0x5172cb) #2 0x518a4e (/out/package/l5_memory_check+0x518a4e) #3 0x518bc9 (/out/package/l5_memory_check+0x518bc9) #4 0x7f597170db96 (/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!