Recently debugging the C and C + + programs written in Linux, the following error occurred while running, the program was dropped. At the same time, I also found a lot of similar errors on the Internet, mostly because the memory released two times.
I have a char buf[2048]={0}; Such an array system is automatically reclaimed and does not need to be released manually. And behind me is Deletepointer (BUF), the result is the following.
[Root@wondersoft ~]# * * * * glibc detected * */root/mag/bin/magserver:free (): Invalid POINTER:0XB6B5CB20 * * ======= Backt Race: =========
/LIB/LIBC.SO.6[0X6EF6C5]
/lib/libc.so.6 (cfree+0x59) [0x6efb09]
/usr/lib/libstdc++.so.6 (_zdlpv+0x21) [0X9C05C1]
/ROOT/MAG/BIN/MAGSERVER[0X804F83F]
/ROOT/MAG/BIN/MAGSERVER[0X804FDD0]
/root/mag/bin/magserver[0x8050a82]
/ROOT/MAG/BIN/MAGSERVER[0X805A256]
/LIB/LIBPTHREAD.SO.0[0X87A832]
/lib/libc.so.6 (CLONE+0X5E) [0x7580ae]
======= Memory Map: ========
00101000-00222000 R-xp 00000000 fd:00 426603/usr/lib/mysql/libmysqlclient.so.15.0.0
00222000-00264000 rwxp 00120000 fd:00 426603/usr/lib/mysql/libmysqlclient.so.15.0.0
00264000-00265000 Rwxp 00264000 00:00 0
00265000-0028b000 R-xp 00000000 fd:00 239126/usr/lib/libk5crypto.so.3.1
0028b000-0028c000 rwxp 00025000 fd:00 239126/usr/lib/libk5crypto.so.3.1
00667000-00682000 R-xp 00000000 fd:00 427157/lib/ld-2.5.so
00682000-00683000 r-xp 0001a000 fd:00 427157/lib/ld-2.5.so
00683000-00684000 rwxp 0001b000 fd:00 427157/lib/ld-2.5.so
00686000-007d9000 R-xp 00000000 fd:00 427158/lib/libc-2.5.so
007d9000-007db000 r-xp 00153000 fd:00 427158/lib/libc-2.5.so
007db000-007dc000 rwxp 00155000 fd:00 427158/lib/libc-2.5.so
007dc000-007df000 Rwxp 007dc000 00:00 0
007e1000-007e4000 R-xp 00000000 fd:00 427162/lib/libdl-2.5.so
007e4000-007e5000 r-xp 00002000 fd:00 427162/lib/libdl-2.5.so
007e5000-007e6000 rwxp 00003000 fd:00 427162/lib/libdl-2.5.so
007e8000-0080f000 R-xp 00000000 fd:00 427160/lib/libm-2.5.so
0080f000-00810000 r-xp 00026000 fd:00 427160/lib/libm-2.5.so
00810000-00811000 rwxp 00027000 fd:00 427160/lib/libm-2.5.so
00813000-00829000 R-xp 00000000 fd:00 298637/lib/libselinux.so.1
00829000-0082b000 rwxp 00015000 fd:00 298637/lib/libselinux.so.1
0082d000-00868000 R-xp 00000000 fd:00 298636/lib/libsepol.so.1
00868000-00869000 rwxp 0003b000 fd:00 298636/lib/libsepol.so.1
00869000-00873000 Rwxp 00869000 00:00 0
00875000-0088a000 R-xp 00000000 fd:00 427161/lib/libpthread-2.5.so
0088a000-0088b000 r-xp 00015000 fd:00 427161/lib/libpthread-2.5.so
0088b000-0088c000 rwxp 00016000 fd:00 427161/lib/libpthread-2.5.so
0088c000-0088e000 Rwxp 0088c000 00:00 0
00890000-008a2000 R-xp 00000000 fd:00 234919/usr/lib/libz.so.1.2.3
008a2000-008a3000 rwxp 00011000 fd:00 234919/usr/lib/libz.so.1.2.3
008b0000-008b9000 R-xp 00000000 fd:00 295313/lib/libcrypt-2.5.so
008b9000-008ba000 r-xp 00008000 fd:00 295313/lib/libcrypt-2.5.so
008ba000-008bb000 rwxp 00009000 fd:00 295313/lib/libcrypt-2.5.so
008bb000-008e2000 Rwxp 008bb000 00:00 0
008e4000-008ef000 R-xp 00000000 fd:00 427164/lib/libgcc_s-4.1.2-20080825.so.1
008ef000-008f0000 rwxp 0000a000 fd:00 427164/lib/libgcc_s-4.1.2-20080825.so.1
008f2000-00907000 R-xp 00000000 fd:00 298644/lib/libnsl-2.5.so
00907000-00908000 r-xp 00014000 fd:00 298644/lib/libnsl-2.5.so
00908000-00909000 rwxp 00015000 fd:00 298644/lib/libnsl-2.5.so
00909000-0090b000 Rwxp 00909000 00:00 0
0090d000-009ed000 R-xp 00000000 fd:00 237907/usr/lib/libstdc++.so.6.0.8
009ed000-009f1000 r-xp 000df000 fd:00 237907/usr/lib/libstdc++.so.6.0.8
009f1000-009f2000 rwxp 000e3000 fd:00 237907/usr/lib/libstdc++.so.6.0.8
009f2000-009f8000 Rwxp 009f2000 00:00 0
009fa000-00a0a000 R-xp 00000000 fd:00 298646/lib/libresolv-2.5.so
00a0a000-00a0b000 r-xp 0000f000 fd:00 298646/lib/libresolv-2.5.so
00a0b000-00a0c000 rwxp 00010000 fd:00 298646/lib/libresolv-2.5.so
00a0c000-00a0e000 Rwxp 00a0c000 00:00 0
00a10000-00a12000 R-xp 00000000 fd:00 298647/lib/libcom_err.so.2.1
00a12000-00a13000 rwxp 00001000 fd:00 298647/lib/libcom_err.so.2.1
00a60000-00a62000 R-xp 00000000 fd:00 298645/lib/libkeyutils-1.2.so
00a62000-00a63000 rwxp 00001000 fd:00 298645/lib/libkeyutils-1.2.so
00a65000-00b8f000 R-xp 00000000 fd:00 298648/lib/libcrypto.so.0.9.8e
00b8f000-00ba2000 rwxp 00129000 fd:00 298648/lib/libcrypto.so.0.9.8e
00ba2000-00ba6000 Rwxp 00ba2000 00:00 0
00ba8000-00c3c000 R-xp 00000000 fd:00 239127/usr/lib/libkrb5.so.3.3
00c3c000-00c3f000 rwxp 00093000 fd:00 239127/usr/lib/libkrb5.so.3.3
00c46000-00c47000 r-xp 00c46000 00:00 0 [VDSO]
00c6a000-00c72000 R-xp 00000000 fd:00 237362/usr/lib/libkrb5support.so.0.1
00c72000-00c73000 rwxp 00007000 fd:00 237362/usr/lib/libkrb5support.so.0.1
00c75000-00ca2000 R-xp 00000000 fd:00 239128/usr/lib/libgssapi_krb5.so.2.2
00ca2000-00ca3000 rwxp 0002d000 fd:00 239128/usr/lib/libgssapi_krb5.so.2.2
00ca5000-00ce9000 R-xp 00000000 fd:00 298649/lib/libssl.so.0.9.8e
00ce9000-00ced000 rwxp 00043000 fd:00 298649/lib/libssl.so.0.9.8e
00e1f000-00e29000 R-xp 00000000 fd:00 295020/lib/libnss_files-2.5.so
00e29000-00e2a000 r-xp 00009000 fd:00 295020/lib/libnss_files-2.5.so
00e2a000-00e2b000 rwxp 0000a000 fd:00 295020/lib/libnss_files-2.5.so
08048000-08070000 R-xp 00000000 fd:00 430777/root/mag/bin/magserver
08070000-08071000 rw-p 00027000 fd:00 430777/root/mag/bin/magserver
08071000-08074000 rw-p 08071000 00:00 0
09a2c000-09a6e000 rw-p 09a2c000 00:00 0 [Heap]
b575c000-b575d000---p b575c000 00:00 0
b575d000-b615d000 rw-p b575d000 00:00 0
b615d000-b615e000---p b615d000 00:00 0
b615e000-b6b5e000 rw-p b615e000 00:00 0
b6b5e000-b6b5f000---p b6b5e000 00:00 0
b6b5f000-b755f000 rw-p b6b5f000 00:00 0
b755f000-b7560000---p b755f000 00:00 0
b7560000-b7f60000 rw-p b7560000 00:00 0
b7f60000-b7f66000 Rw-s 00000000 00:09 2883591/sysv00000000 (Deleted)
b7f66000-b7f6c000 rw-p b7f66000 00:00 0
bf8e9000-bf8fe000 rw-p bffe9000 00:00 0 [Stack]