Xi: xibarriers: protect add_master_func() from allocation failure
Try to gracefully handle OOM situation, at not hard crashing. | ../Xi/xibarriers.c: In function ‘add_master_func’: | ../Xi/xibarriers.c:729:19: warning: dereference of NULL ‘pbd’ [CWE-476] [-Wanalyzer-null-dereference] | 729 | pbd->deviceid = *deviceid; | | ~~~~~~~~~~~~~~^~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
d91121e876
commit
cb69b80973
|
@ -722,14 +722,14 @@ static void add_master_func(void *res, XID id, void *devid)
|
|||
{
|
||||
struct PointerBarrier *b;
|
||||
struct PointerBarrierClient *barrier;
|
||||
struct PointerBarrierDevice *pbd;
|
||||
int *deviceid = devid;
|
||||
|
||||
b = res;
|
||||
barrier = container_of(b, struct PointerBarrierClient, barrier);
|
||||
|
||||
|
||||
pbd = AllocBarrierDevice();
|
||||
struct PointerBarrierDevice *pbd = AllocBarrierDevice();
|
||||
if (!pbd)
|
||||
return;
|
||||
pbd->deviceid = *deviceid;
|
||||
|
||||
input_lock();
|
||||
|
|
Loading…
Reference in New Issue