home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.programmer
- Path: sparky!uunet!ocsmd!gumby!obi
- From: obi@gumby.ocs.com (Kuryan "Obi" Thomas)
- Subject: Re: I am stumped on this one!!!
- Message-ID: <BryMox.4E9@gumby.ocs.com>
- Sender: obi@gumby (Kuryan "Obi" Thomas)
- Reply-To: obi@gumby.ocs.com
- Organization: Online Computer Systems, Inc.
- References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu>
- Date: Sat, 25 Jul 1992 19:41:20 GMT
- Lines: 19
-
- In article <Brx394.4qL@undergrad.math.waterloo.edu>,
- bbobak@undergrad.math.waterloo.edu (Brad Bobak) writes:
- > In article <1992Jul24.204944.18516@cbfsb.cb.att.com>
- > rajeev@cbnewsf.cb.att.com (rajeev.dolas) writes:
-
- < Bunch of code deleted >
- >
- > You're allocing the sizeof an int, which is likely four bytes.
- > You also forgot to alloc space for the '\0'. Try it again with:
- >
- > cp_line = (char*)malloc(sizeof(strlen(pars_wbuf) + 1));
- >
-
- I believe it should read
-
- cp_line = (char*) malloc(strlen(pars_wbuf) + 1);
-
- that is, leave out the sizeof. I think this is what Brad intended to say;
- leaving the sizeof in there results in an allocation of 4 bytes.
-