http://bugzilla.novell.com/show_bug.cgi?id=612790
http://bugzilla.novell.com/show_bug.cgi?id=612790#c1
--- Comment #1 from Chengshun Xia 2010-06-09 09:35:00 UTC ---
Sorry, Comment is messy,correct it, above comment is obsolete
Code:
#include
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int *i = new int(100);
auto_ptr<int> p1(i);
auto_ptr<int> p2(i);
cout << *p1 << endl;
cout << *p2 << endl;
}
Result:
csxia-laptop:/data/learning/CPP/cpp_learning/stl # ./auto_ptr
100
100
*** glibc detected *** ./auto_ptr: double free or corruption (fasttop):
0x0804b008 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7698654]
/lib/libc.so.6(cfree+0x9c)[0xb7699f3c]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7879ec1]
/auto_ptr[0x8048927]
/auto_ptr[0x80488ac]
/lib/libc.so.6(__libc_start_main+0xe5)[0xb7642705]
/auto_ptr[0x8048701]
======= Memory map: ========
08048000-08049000 r-xp 00000000 08:06 1433820
/data/learning/CPP/cpp_learning/stl/auto_ptr
08049000-0804a000 r--p 00000000 08:06 1433820
/data/learning/CPP/cpp_learning/stl/auto_ptr
0804a000-0804b000 rw-p 00001000 08:06 1433820
/data/learning/CPP/cpp_learning/stl/auto_ptr
0804b000-0806c000 rw-p 0804b000 00:00 0 [heap]
b7500000-b7521000 rw-p b7500000 00:00 0
b7521000-b7600000 ---p b7521000 00:00 0
b762a000-b762c000 rw-p b762a000 00:00 0
b762c000-b7781000 r-xp 00000000 08:08 32984 /lib/libc-2.9.so
b7781000-b7782000 ---p 00155000 08:08 32984 /lib/libc-2.9.so
b7782000-b7784000 r--p 00155000 08:08 32984 /lib/libc-2.9.so
b7784000-b7785000 rw-p 00157000 08:08 32984 /lib/libc-2.9.so
b7785000-b7788000 rw-p b7785000 00:00 0
b7788000-b7795000 r-xp 00000000 08:08 32819 /lib/libgcc_s.so.1
b7795000-b7796000 r--p 0000c000 08:08 32819 /lib/libgcc_s.so.1
b7796000-b7797000 rw-p 0000d000 08:08 32819 /lib/libgcc_s.so.1
b7797000-b77be000 r-xp 00000000 08:08 32988 /lib/libm-2.9.so
b77be000-b77bf000 r--p 00026000 08:08 32988 /lib/libm-2.9.so
b77bf000-b77c0000 rw-p 00027000 08:08 32988 /lib/libm-2.9.so
b77c0000-b78a8000 r-xp 00000000 08:08 803153 /usr/lib/libstdc++.so.6.0.10
b78a8000-b78a9000 ---p 000e8000 08:08 803153 /usr/lib/libstdc++.so.6.0.10
b78a9000-b78ad000 r--p 000e8000 08:08 803153 /usr/lib/libstdc++.so.6.0.10
b78ad000-b78ae000 rw-p 000ec000 08:08 803153 /usr/lib/libstdc++.so.6.0.10
b78ae000-b78b4000 rw-p b78ae000 00:00 0
b78ca000-b78cc000 rw-p b78ca000 00:00 0
b78cc000-b78ea000 r-xp 00000000 08:08 33181 /lib/ld-2.9.so
b78ea000-b78eb000 r--p 0001d000 08:08 33181 /lib/ld-2.9.so
b78eb000-b78ec000 rw-p 0001e000 08:08 33181 /lib/ld-2.9.so
bfee8000-bfefd000 rw-p bffeb000 00:00 0 [stack]
ffffe000-fffff000 r-xp 00000000 00:00 0 [vdso]
Aborted
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.