summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-04-28 16:20:09 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-05-06 17:47:11 -0700
commit4a1b2330ff2589c3c56159f3113710950d41b39b (patch)
tree78645c748c41a1e0933ab3b572577595301a07f5
parent36e461f8b3cfc7133801ec95ca31a363819ed91a (diff)
WriteToClient: handle allocation failureHEADmaster
os/io.c: In function ‘write_to_client_internal’: os/io.c:562:5: warning: use of possibly-NULL ‘buf’ where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] 562 | memmove( (char *) oco->buf + oco->count, buf, count); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/app/xfs/-/merge_requests/7>
-rw-r--r--os/io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/os/io.c b/os/io.c
index b94fd60..458037c 100644
--- a/os/io.c
+++ b/os/io.c
@@ -580,8 +580,10 @@ WriteToClient(ClientPtr client, int count, char *buf)
if (NULL == buf) {
flag = -1;
buf = (char *) FScalloc(1, count);
+ if (buf == NULL)
+ FatalError("WriteToClient couldn't create client buffer\n");
}
- write_to_client_internal(client, count, buf, padlength[count & 3]);
+ write_to_client_internal(client, count, buf, padlength[count & 3]);
if (flag)
FSfree(buf);
}