mirror of https://gerrit.osmocom.org/libosmocore
gprs: Add assertion for msg != NULL to bssgp_msgb_alloc (Coverity)
Currently out-of-memory is not handled by bssgp_msgb_alloc, leading to SEGV failures if msgb_alloc_headroom returns NULL. This commit adds an OSMO_ASSERT to catch this case, which improves the situation only slightly. But bssgp_msgb_alloc is used in many places without checking the return value, so just adding a conditional early NULL return would not fix the issue either. Fixes: Coverity CID 1293377 Sponsored-by: On-Waves ehf
This commit is contained in:
parent
d154f8bda2
commit
a84db61673
|
@ -71,6 +71,10 @@ const char *bssgp_cause_str(enum gprs_bssgp_cause cause)
|
|||
struct msgb *bssgp_msgb_alloc(void)
|
||||
{
|
||||
struct msgb *msg = msgb_alloc_headroom(4096, 128, "BSSGP");
|
||||
|
||||
/* TODO: Add handling of msg == NULL to this function and to all callers */
|
||||
OSMO_ASSERT(msg != NULL);
|
||||
|
||||
msgb_bssgph(msg) = msg->data;
|
||||
return msg;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue