Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==46743==ERROR: LeakSanitizer: detected memory leaks Direct leak of 320 byte(s) in 8 object(s) allocated from: #0 0x7f4a55fcfb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) #1 0x562bad3862fb in pushBack (/out/package/ex6+0x52fb) #2 0x562bad386a0a in createFromArray (/out/package/ex6+0x5a0a) #3 0x562bad385437 in main (/out/package/ex6+0x4437) #4 0x7f4a54e00b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) Indirect leak of 320 byte(s) in 8 object(s) allocated from: #0 0x7f4a55fcfb40 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb40) #1 0x562bad3862fb in pushBack (/out/package/ex6+0x52fb) #2 0x562bad386a0a in createFromArray (/out/package/ex6+0x5a0a) #3 0x562bad385437 in main (/out/package/ex6+0x4437) #4 0x7f4a54e00b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) SUMMARY: AddressSanitizer: 640 byte(s) leaked in 16 alloc
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
JOJ Answer
Linked-List: 5067->2992->1161->1986->3821->3215->3289->503->2593->3061->3184->2522->4245->3650->1647->5682->854->5094->375->3605->5002->254->5712->846->445->869->2848->2367->300->368->2622->5129->6194->745->3318->2670->2276->3519->2118->5016->1582->2923->4763->2796->4801->5307->5497->91->2168->4093->4->6009->4843->4197->126->569->2480->5945->3419->4676->231->4100->3523->4669->5999->3460->3985->5395->2301->834->169->5656->3499->4710->5186->1404->2135->2359->5450->2007->1731->122->1717->380->5397->3331->1269->3188->3297->1152->1762->4301->5019->3257->1356->3207->5199->1074->2845->3535->1659->2517->2095->2575->4875->2154->128->628->1176->290->1350->924->434->1159->2209->34->117->3474->1043->4381->552->2287->3663->50->5063->2330->2410->1664->5614->327->3488->1132->5890->6141->4495->4246->3026->6038->1326->2299->1904->2239->4915->400->1042->783->1038->1936->2921->4956->2766->502->3424->3380->5888->3399->2916->2082->224->330->2685->3547->2837->1644->5163->4657->4968->726->6182->5286->3584->1504->1197->6179->1409->1