Null checks for malloc() return

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
Demi Marie Obenour 2023-06-01 16:33:07 -04:00
parent 4a8fac2831
commit cb9e1f4244

View File

@ -1556,6 +1556,8 @@ def _c_serialize(context, self):
_c(' if (NULL == %s) {', aux_ptr)
_c(' /* allocate memory */')
_c(' %s = malloc(xcb_buffer_len);', aux_ptr)
_c(' if (%s == NULL)', aux_ptr)
_c(' return -1;')
if 'serialize' == context:
_c(' *_buffer = xcb_out;')
_c(' }')