Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==46666==ERROR: AddressSanitizer: heap-use-after-free on address 0x60400004e1d0 at pc 0x5590485856a0 bp 0x7ffdf0006240 sp 0x7ffdf0006230 READ of size 4 at 0x60400004e1d0 thread T0 #0 0x55904858569f in findBook_test (/out/package/ex6+0x569f) #1 0x559048584712 in main (/out/package/ex6+0x4712) #2 0x7f39fc793b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) #3 0x5590485836f9 in _start (/out/package/ex6+0x36f9) 0x60400004e1d0 is located 0 bytes inside of 40-byte region [0x60400004e1d0,0x60400004e1f8) freed by thread T0 here: #0 0x7f39fd9627a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8) #1 0x559048583b6e in removeBook (/out/package/ex6+0x3b6e) #2 0x55904858451b in main (/out/package/ex6+0x451b) #3 0x7f39fc793b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96) previously allocated by thread T0 here: #0 0x7f39fd962b40 in __interceptor_malloc (/usr/lib/x86_
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