🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #124

Re: I am stumped on this one!!!

#124
From: Kuryan "Obi" Thomas
Date: Sat, 25 Jul 1992 19:41
19 lines
1139 bytes
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.
Technical Details
Message-ID: <BryMox.4E9@gumby.ocs.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!ocsmd!gumby!obi
References: <1992Jul24.204944.18516@cbfsb.cb.att.com> <Brx394.4qL@undergrad.math.waterloo.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.unix.programmer
Path: arc1-ca.pugleaf.net!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