Devil@Devil test$ ./test
123 456
579
*** glibc detected *** ./test: double free or corruption (out): 0x08cdead8 ***
======= Backtrace: =========
/lib/libc.so.6[0xada1a1]
/usr/lib/libstdc++.so.6(_ZdlPv+0x22)[0x47e4b2]
./test[0x804b97b]
./test[0x804b266]
./test[0x804b0fc]
./test[0x804a661]
./test[0x8049e9f]
./test[0x8049c64]
./test[0x804dc51]
/lib/libc.so.6(__libc_start_main+0xe6)[0xa81cc6]
./test[0x8048be1]
======= Memory map: ========
0029d000-002ba000 r-xp 00000000 08:08 527256
/lib/libgcc_s-4.4.4-20100503.so.1
002ba000-002bb000 rw-p 0001d000 08:08 527256
/lib/libgcc_s-4.4.4-20100503.so.1
003cf000-004b0000 r-xp 00000000 08:08 1053510
/usr/lib/libstdc++.so.6.0.13
004b0000-004b4000 r--p 000e0000 08:08 1053510
/usr/lib/libstdc++.so.6.0.13
004b4000-004b6000 rw-p 000e4000 08:08 1053510
/usr/lib/libstdc++.so.6.0.13
004b6000-004bc000 rw-p 00000000 00:00 0
0054c000-0054d000 r-xp 00000000 00:00 0
[vdso]
00a49000-00a67000 r-xp 00000000 08:08 526142
/lib/ld-2.12.so
00a67000-00a68000 r--p 0001d000 08:08 526142
/lib/ld-2.12.so
00a68000-00a69000 rw-p 0001e000 08:08 526142
/lib/ld-2.12.so
00a6b000-00bf0000 r-xp 00000000 08:08 526147
/lib/libc-2.12.so
00bf0000-00bf1000 ---p 00185000 08:08 526147
/lib/libc-2.12.so
00bf1000-00bf3000 r--p 00185000 08:08 526147
/lib/libc-2.12.so
00bf3000-00bf4000 rw-p 00187000 08:08 526147
/lib/libc-2.12.so
00bf4000-00bf7000 rw-p 00000000 00:00 0
00bf9000-00c21000 r-xp 00000000 08:08 527238
/lib/libm-2.12.so
00c21000-00c22000 r--p 00027000 08:08 527238
/lib/libm-2.12.so
00c22000-00c23000 rw-p 00028000 08:08 527238
/lib/libm-2.12.so
08048000-08050000 r-xp 00000000 08:08 410638
/home/Devil/workplace/test/test
08050000-08051000 rw-p 00008000 08:08 410638
/home/Devil/workplace/test/test
08cde000-08cff000 rw-p 00000000 00:00 0
[heap]
b7817000-b7819000 rw-p 00000000 00:00 0
b783a000-b783d000 rw-p 00000000 00:00 0
bf967000-bf97c000 rw-p 00000000 00:00 0
[stack]
Aborted
Devil@Devil test$ vi main.cpp
Devil@Devil test$
bug是无可避免的。