Notes
This function is in beta test. Please help improve it in the issues
here.
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
mumsh $ 123 mumsh $ ================================================================= ==4327==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000000040 at pc 0x0000004b2877 bp 0x7ffccc4431b0 sp 0x7ffccc442960 READ of size 1 at 0x60c000000040 thread T0 #0 0x4b2876 (/out/package/mumsh_memory_check+0x4b2876) #1 0x51fee5 (/out/package/mumsh_memory_check+0x51fee5) #2 0x7f5518d88b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x41cf89 (/out/package/mumsh_memory_check+0x41cf89) 0x60c000000040 is located 0 bytes inside of 120-byte region [0x60c000000040,0x60c0000000b8) freed by thread T0 here: #0 0x4dcc70 (/out/package/mumsh_memory_check+0x4dcc70) #1 0x51ffe9 (/out/package/mumsh_memory_check+0x51ffe9) #2 0x7f5518d88b96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by thread T0 here: #0 0x4dce40 (/out/package/mumsh_memory_check+0x4dce40) #1 0x7f5518de6b8b (/lib/x86_64-linux-gnu/libc.so.6+0x7fb8b) SUMMARY: AddressSanitizer: heap-use-after-fr
JOJ Answer
mumsh $ 123 mumsh $ mumsh $ exit