Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr

=================================================================
==47705==ERROR: AddressSanitizer: heap-use-after-free on address 0x6040000018d0 at pc 0x55ba4eeb66a0 bp 0x7ffdb45267d0 sp 0x7ffdb45267c0
READ of size 4 at 0x6040000018d0 thread T0
    #0 0x55ba4eeb669f in findBook_test (/out/package/ex6+0x569f)
    #1 0x55ba4eeb5712 in main (/out/package/ex6+0x4712)
    #2 0x7f39811bcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #3 0x55ba4eeb46f9 in _start (/out/package/ex6+0x36f9)

0x6040000018d0 is located 0 bytes inside of 40-byte region [0x6040000018d0,0x6040000018f8)
freed by thread T0 here:
    #0 0x7f398238b7a8 in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xde7a8)
    #1 0x55ba4eeb4b6e in removeBook (/out/package/ex6+0x3b6e)
    #2 0x55ba4eeb551b in main (/out/package/ex6+0x451b)
    #3 0x7f39811bcb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

previously allocated by thread T0 here:
    #0 0x7f398238bb40 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


        

JOJ Answer

Linked-List:
1659->2517->2095->2575->1775->2154->128->628->1176->290->1350->924->434->1159->2209->34->117->374->1043->1281->552->2287->563->50->1963->2330->2410->1664->2514->327->388->1132->2790->3041->1395->1146->3026->2938->1326->2299->1904->2239->1815->400->1042->783->1038->1936->2921->1856->2766->502->324->280->2788->299->2916->2082->224->330->2685->447->2837->1644->2063->1557->1868->726->3082->2186->484->1504->1197->3079->1409->1154->962->2282->1218->1367->479->1433->813->25->464->2754->2123->1534->2497->1825->592->3089->432->228->1823->1336->523->2782->2290->1578->NULL
findBook(2063): PASS
findBook(2788): PASS
findBook(2330): PASS
findBook(1659): PASS
removeBook(432): PASS
findBook(2938): PASS
removeBook(400): PASS
findBook(1815): PASS