[PATCH] queue_new(): if calloc fails, abort (CID #57918)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Sat Apr 16 11:37:41 UTC 2016


Hi Neels

On Thu, Apr 14, 2016 at 04:38:42PM +0200, Neels Hofmeyr wrote:
> Coverity complains about a 'Dereference before null check' on *queue.
> So, push the NULL check further up, 

No question here.

> but also, instead of handling a calloc failure as error, rather abort
> the program.

I think that's a much more fundamental question.  Should we really abort
the program in this case?  If so, why only in case of queue allocation
failures, but not in general at all memory allocation failures?  And if
that's the case, wrapping calloc() / malloc() and other dynamic memory
allocation calls with a function that contains the abort() (or an
OSMO_ASSERT() on the result) might be more applicable?

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



More information about the OpenBSC mailing list