Source-Changes-D archive

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

Re: CVS commit: src/usr.sbin/envstat



On Thu, Dec 13, 2012 at 08:45:02PM -0800, Paul Goyette wrote:
> It seems that the following commit has introduced a regression for the 
> dev/sysmon/t_swsensor atf tests (for details, see test results at 
> http://screamer.whooppee.com/amd64-results/4722_1_atf.html)
> 
> >Module Name:    src
> >Committed By:   christos
> >Date:           Thu Dec 13 20:06:42 UTC 2012
> >
> >Modified Files:
> >        src/usr.sbin/envstat: envstat.c
> >
> >Log Message:
> >- no point in allocating memory to hold command line arguments.
> >- allocate memory inside the function used.
> 
> I'll take a look and see what happened.  The tests should get fixed 
> fairly soon.

If you are worried about malloc() fails then (maybe) allocating
memory when parsing the command line would make sense - since
any fail is then guaranteed to happen before any processing.

OTOH malloc() is unlikely to fail for small programs unless
someone is testing whether the program survives malloc failure.

Similarly it just isn't worth trying to free resources prior
to program exit. Have you ever waited while a big C++ program
runs all its destructors, paging in code and data just to exit!

About the only environment wheere is matters is when programs are
run as shell builtins - and that will always be a small subset of
programs.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index