mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-03-31 04:10:41 +02:00
os: handle memory allocation failure in set_font_authorizations()
Reported in #1817: xwayland-24.1.6/redhat-linux-build/../os/utils.c:1108:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘result’ xwayland-24.1.6/redhat-linux-build/../os/utils.c:1108:9: danger: ‘malloc((long unsigned int)len + 18)’ could be NULL: unchecked value from (3) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
16ca2c7a11
commit
fde685eefe
1 changed files with 8 additions and 0 deletions
|
|
@ -1115,6 +1115,14 @@ set_font_authorizations(char **authorizations, int *authlen, void *client)
|
|||
|
||||
len = strlen(hnameptr) + 1;
|
||||
result = malloc(len + sizeof(AUTHORIZATION_NAME) + 4);
|
||||
if (result == NULL) {
|
||||
#if defined(HAVE_GETADDRINFO)
|
||||
if (ai) {
|
||||
freeaddrinfo(ai);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
p = result;
|
||||
*p++ = sizeof(AUTHORIZATION_NAME) >> 8;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue