*** glibc detected *** ./a.out: free(): invalid pointer: 0x00007fefc6176010 *** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7a6e6)[0x7fefda73b6e6] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7fefda73f9cc] ./a.out[0x408491] ./a.out[0x408565] ./a.out[0x401048] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefda6e230d] ./a.out[0x400a59] ======= Memory map: ======== 00400000-0040b000 r-xp 00000000 07:00 299109 /home/skyjuice/PROJECT3/a.out 0060a000-0060b000 r--p 0000a000 07:00 299109 /home/skyjuice/PROJECT3/a.out 0060b000-0060c000 rw-p 0000b000 07:00 299109 /home/skyjuice/PROJECT3/a.out 0060c000-059f8000 rw-p 00000000 00:00 0 05ebb000-05ee3000 rw-p 00000000 00:00 0 [heap] 7fefc0000000-7fefc0021000 rw-p 00000000 00:00 0 7fefc0021000-7fefc4000000 ---p 00000000 00:00 0 7fefc59d3000-7fefc59d4000 rw-p 00000000 00:00 0 7fefc5f60000-7fefc5f75000 r-xp 00000000 07:00 2117 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fefc5f75000-7fefc6174000 ---p 00015000 07:00 2117 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fefc6174000-7fefc6175000 r--p 00014000 07:00 2117 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fefc6175000-7fefc6176000 rw-p 00015000 07:00 2117 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fefc6176000-7fefda6c1000 rw-p 00000000 00:00 0 7fefda6c1000-7fefda858000 r-xp 00000000 07:00 904195 /lib/x86_64-linux-gnu/libc-2.13.so 7fefda858000-7fefdaa57000 ---p 00197000 07:00 904195 /lib/x86_64-linux-gnu/libc-2.13.so 7fefdaa57000-7fefdaa5b000 r--p 00196000 07:00 904195 /lib/x86_64-linux-gnu/libc-2.13.so 7fefdaa5b000-7fefdaa5c000 rw-p 0019a000 07:00 904195 /lib/x86_64-linux-gnu/libc-2.13.so 7fefdaa5c000-7fefdaa62000 rw-p 00000000 00:00 0 7fefdaa62000-7fefdaae5000 r-xp 00000000 07:00 904199 /lib/x86_64-linux-gnu/libm-2.13.so 7fefdaae5000-7fefdace4000 ---p 00083000 07:00 904199 /lib/x86_64-linux-gnu/libm-2.13.so 7fefdace4000-7fefdace5000 r--p 00082000 07:00 904199 /lib/x86_64-linux-gnu/libm-2.13.so 7fefdace5000-7fefdace6000 rw-p 00083000 07:00 904199 /lib/x86_64-linux-gnu/libm-2.13.so 7fefdace6000-7fefdad07000 r-xp 00000000 07:00 644102 /lib/x86_64-linux-gnu/ld-2.13.so 7fefdaeeb000-7fefdaeee000 rw-p 00000000 00:00 0 7fefdaf04000-7fefdaf06000 rw-p 00000000 00:00 0 7fefdaf06000-7fefdaf07000 r--p 00020000 07:00 644102 /lib/x86_64-linux-gnu/ld-2.13.so 7fefdaf07000-7fefdaf09000 rw-p 00021000 07:00 644102 /lib/x86_64-linux-gnu/ld-2.13.so 7fff1b020000-7fff1b0ca000 rw-p 00000000 00:00 0 [stack] 7fff1b148000-7fff1b149000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] Aborted |
|
|
sizeof()
returns the number of bytes that the variable, array, or whatever takes up. So instead of returning the value of a variable, it returns the number of bytes the variable takes up. I'm not really sure if that will make a difference at all, because I'm new to C++ and have never programmed in C before (and am pretty confused by your code), so I could be completely wrong. Let me know if this helps, or if you find the answer.
|
|
*** glibc detected *** ./a.out: double free or corruption (out): 0x00007f91023df010 *** |