Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/libexec/comsat



Jun-ichiro itojun Hagino wrote:

> Module Name:  src
> Committed By: itojun
> Date:         Fri Sep 19 05:33:17 UTC 2003
> 
> Modified Files:
> 
>       src/libexec/comsat: comsat.c
> 
> Log Message:
> 
> realloc mistake. from openbsd

I'm not sure I understand what actually changed here.  The old code did:

        newsize = some expression;
        buf = realloc(newsize);
        if (buf == NULL)
                exit();

Now we say:

        tmp buf = realloc(some expression);
        if (tmp buf == NULL)
                exit();
        buf = tmp buf;
        newsize = some expression;

It seems to me that we've introduced extra complexity for absolutely no
reason at all.  Because the program exits immediately in the failure
case (without jumping through a pile of clean-up functions), there's
no chance that an invalid buffer or buffersize will be used in further
code.

Simon.
--
Simon Burge                            <simonb%wasabisystems.com@localhost>
NetBSD Support and Service:         http://www.wasabisystems.com/



Home | Main Index | Thread Index | Old Index