I am learning C++ from the book of stroustrup: programming practice and principles using C++. I program on ubuntu 8.10 using the gcc compiler with the g++ script to compile c++ code. I fail to run the first example program of chapter 12 of this book (section 12.3, page 411), is is freely available on the website: stroustrup.com/Programming/, also the libs needed are available there.

Compling goes fine, but if I run the program I get into trouble:
*** glibc detected *** ./12-3: free(): invalid size: 0x00007fffb4bb4b50 ***
======= Backtrace: =========
/lib/libc.so.6[0x7f29aba2fa58]
/lib/libc.so.6(cfree+0x76)[0x7f29aba320a6]

and so on...

I was a bit surprised because I ran exactly the example given in the book, I get the same problems with other examples of this chapter, but not of previous chapters. Anyone a clue how I can trace this the cause of this memory problem?

I think maybe the libs provided by the book's website are compiled with a different version of glibc. If the source is available, try to compile the libs on your machine, then use those compiled libs instead of the pre-compiled libs provided.