From cb9e1f42440b003156258020b7171178104fee97 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 1 Jun 2023 16:33:07 -0400 Subject: [PATCH] Null checks for malloc() return Signed-off-by: Demi Marie Obenour --- src/c_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/c_client.py b/src/c_client.py index f8cb2b3..a80d4ba 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -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(' }')