Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==46257==ERROR: AddressSanitizer: heap-use-after-free on address 0x60400000e570 at pc 0x55879018c899 bp 0x7ffd8564a5a0 sp 0x7ffd8564a590 READ of size 8 at 0x60400000e570 thread T0 #0 0x55879018c898 in removeBook (/out/package/ex6+0x3898) #1 0x55879018d250 in main (/out/package/ex6+0x4250) #2 0x7ff2b2a41b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x55879018c549 in _start (/out/package/ex6+0x3549) 0x60400000e570 is located 32 bytes inside of 40-byte region [0x60400000e550,0x60400000e578) freed by thread T0 here: #0 0x7ff2b3c107a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8) #1 0x55879018c846 in removeBook (/out/package/ex6+0x3846) #2 0x55879018d250 in main (/out/package/ex6+0x4250) #3 0x7ff2b2a41b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by thread T0 here: #0 0x7ff2b3c10b40 in __interceptor_malloc (/usr/lib/x86_64
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
Linked-List: 112976->44143->129093->77872->72715->82619->99133->88637->118336->151165->6345->76471->81493->137856->55747->128472->141719->126796->133090->30101->10763->86221->61911->87851->98526->42286->6415->52085->24661->66182->35103->126428->5122->92387->139078->119282->61615->40939->41865->28320->23489->134372->108020->151136->42598->109030->70266->74681->5516->123190->36560->35038->77033->4213->44768->46441->17625->53881->130629->11881->61059->56364->142350->154488->30772->56786->77417->146943->17450->21140->75300->27353->91774->39518->81565->62162->102075->38121->125478->4805->32347->103918->30592->141588->104535->29459->119391->147821->74265->24531->20219->139240->44211->152477->39336->56277->71643->145097->84366->76310->101482->123856->50476->51091->43444->50332->97270->119422->21559->129213->4407->113031->114780->135844->111713->68842->94860->127602->48673->93968->98149->141763->118523->80834->49239->85558->150333->2262->115510->25834->50391->39060->108821->79022->28772->123056->115015->22176->128081
JOJ Answer
Linked-List: 112976->44143->129093->77872->72715->82619->99133->88637->118336->151165->6345->76471->81493->137856->55747->128472->141719->126796->133090->30101->10763->86221->61911->87851->98526->42286->6415->52085->24661->66182->35103->126428->5122->92387->139078->119282->61615->40939->41865->28320->23489->134372->108020->151136->42598->109030->70266->74681->5516->123190->36560->35038->77033->4213->44768->46441->17625->53881->130629->11881->61059->56364->142350->154488->30772->56786->77417->146943->17450->21140->75300->27353->91774->39518->81565->62162->102075->38121->125478->4805->32347->103918->30592->141588->104535->29459->119391->147821->74265->24531->20219->139240->44211->152477->39336->56277->71643->145097->84366->76310->101482->123856->50476->51091->43444->50332->97270->119422->21559->129213->4407->113031->114780->135844->111713->68842->94860->127602->48673->93968->98149->141763->118523->80834->49239->85558->150333->2262->115510->25834->50391->39060->108821->79022->28772->123056->115015->22176->128081