home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3914 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.1 KB  |  32 lines

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