mirror of https://gerrit.osmocom.org/libosmocore
use_count: Return if uc is NULL
The documentation for osmo_use_count_get_put states the return value is "Negative on range violations or USE_LIST == NULL, the use_cb()'s return value, or 0 on success" However, the code in _osmo_use_count_get_put doesn't check if uc is NULL - instead it would crash in osmo_use_count_find() where it is dereferenced. Add a check for uc and return -EINVAL if it is NULL. Change-Id: I792563696860a3100e95cafdd5fe57511819ef56 Related: SYS#5895
This commit is contained in:
parent
709da278ca
commit
d5150a61fc
|
@ -235,6 +235,8 @@ int _osmo_use_count_get_put(struct osmo_use_count *uc, const char *use, int32_t
|
|||
{
|
||||
struct osmo_use_count_entry *e;
|
||||
int32_t old_use_count;
|
||||
if (!uc)
|
||||
return -EINVAL;
|
||||
if (!change)
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue