This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [A K KARTIK <akkartik@mailcity.com>] libc/1158: glibc: segmentation fault within malloc
- To: aj@arthur.rhein-neckar.de
- Subject: Re: [A K KARTIK <akkartik@mailcity.com>] libc/1158: glibc: segmentation fault within malloc
- From: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
- Date: 12 Jun 1999 12:03:25 -0000
- CC: libc-alpha@sourceware.cygnus.com
- References: <u8g13xapqc.fsf@arthur.rhein-neckar.de>
> Could anybody with c++ knowledge look into the appended bug report and
> tell us what's wrong? I get the same error with glibc 2.1.1.
No C++ knowledge necessary :-)... Just wasted 10 minutes on this..
> actnode = (node*) malloc (total_size * sizeof (actnode)) ;
What's wrong with this line ?
Hint: sizeof (type*) != sizeof (type).
Can someone write a Perl script to detect suspicious lines like this?
Morale: always use operator new in C++, it was designed with good
reason.
Regards,
Wolfram.
--
`Surf the sea, not double-u three...'
wmglo@dent.med.uni-muenchen.de