1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +01:00

WUtil: Make sure wmalloc/wrealloc won't fail because of the abort handler

As pointed by Coverity (#50074), despite the expected behaviour that
'wmalloc' should never return NULL, it may still happen if an abort handler
set by user (with wsetabort) does not call exit() as expected. In such
case we make sure the NULL pointer dereference does not happen inside
WINGs code because we assume it is a known user choice.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2021-05-16 15:47:05 +02:00
committed by Carlos R. Mafra
parent 6ebec0bb9f
commit 816fa00625

View File

@@ -107,7 +107,8 @@ void *wmalloc(size_t size)
}
}
}
memset(tmp, 0, size);
if (tmp != NULL)
memset(tmp, 0, size);
return tmp;
}