Hi everobody!
It seems to very strange situation with malloc sys call in
SCO ODT 1.0.0(Unix 3.2.1) - it OFTEN dumps core in even a
very simple & apparently childish situation,like these:
1.
I define {p} as pointer to char:
char *p;
Then somewhere in programm I try to catch some memory:
p=(char *)malloc(1);( I need only 1 byte this case,but I
had tried to request other values^when testing - no sense).
Unix immediately dumps core;
2.
I read some file by fgets. Both buffer,value of bytes to read,
& FILE pointer ARE OK. But after some succesful iteration(classic
exemple with while(fgets()!=NULL) {} - Unix again dumps core.
When I later examine the corpse with either adb or sdb - I see,
that final function called was malloc. :) . Memory amount it
(I mean malloc) requires before the death is quite reasonable.
Futhermore - even if it was too big - why use such a radical
method - it's possible just to return NULL ?
It looks like a real BUG - doesn't it?. It makes me [sm]ad!
Any bright ideas would be appreciated.
P.S - I've just carefully read man pages on malloc - it says
it is possible to use newer version of malloc - when specifyi-
ng other library to linker by option -lmalloc.
I had done so - & now it seems to be working fine... But I still
have a question,asked above. :)
Best wishes to you.
/=============================================================\
| Rashid Karimov - System Administrator of e-mail node |
| machine in Saratov, Russia. Phone : 8452 242491. |
| (-:*:-( |
| "To open new business just begin it. The beginning itself |
| is a good half of any big deal." /Updated from Goracius / |
\=============================================================/