[tpop3d-discuss] Minor errors in tpop3d .. purify is so handy :)

Chris Lightfoot chris at ex-parrot.com
Mon, 11 Feb 2002 14:02:16 +0000


On Mon, Feb 11, 2002 at 01:19:25PM +0000, Chris Elsworth wrote:
> Heya.
> 
> Not sure if you're too fussed about this, but I've just run tpop3d
> through purify on Solaris and found a couple of minor errors - it's
> really a testament to the authors that there are only two, so good
> work chaps :)

Excellent. I'm told that Purify is a nice tool....

> Here's what it did find:
> 
> in log_init() in logging.c, line 71, there is an unitialized memory
> read. Local variable warn is not explicitly set to anything, so it's
> possible that it will be compared with unitialized memory. Simple
> resolution - line 57 is the definition and could contain an initial
> variable of 0.

Yep, that's an error. Now fixed.

> Secondly, there's a bit of leaked memory in read_config_file(), in
> config.c at line 92. strdup allocates memory via malloc, and purify
> reckons there is 21 bytes (told you they were minor errors) being
> leaked here - 2 blocks of 5 bytes, 2 blocks of 4 bytes, and a block of
> 3 bytes.

This isn't really a memory leak-- strdup is called to copy
the text of the config directives, which must be
accessible through the lifetime of the program.

-- 
 ``Stupidity is like nuclear power: it can be used for good and evil
   And, you don't want to get any of it on you.'' (from `Dilbert')