This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [A K KARTIK <akkartik@mailcity.com>] libc/1158: glibc: segmentation fault within malloc


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]