*** glibc detected *** /root/MAG/bin/MAGServer: free(): invalid pointer: 0xb6b5cb20 ***错误解决办法

最近调试自己在linux里编写的c和c++程序,运行的时候出现下面的错误,程序崩掉了!同时自己也在网上找了很多相似的错误,大部分原因是内存释放了两次。

我有一个char buf[2048]={0};这样的数组系统会自动回收,不需要手动释放。而我后面却有deletepointer(buf),导致的结果就是下面的。

[root@wondersoft ~]# *** glibc detected *** /root/MAG/bin/MAGServer: free(): invalid pointer: 0xb6b5cb20 ***

======= Backtrace: =========
/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]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值