summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2019-03-24 14:36:10 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2019-03-24 14:36:10 -0700
commit2318ace3340009c44e78eab094f159f0e0b4a197 (patch)
tree1b953d835802a738ba0232621e1d90396a7c4c8f
parentb484311c929a1b64966d89da92fafce7263006e1 (diff)
IceOpenConnection: check for malloc failure on connect_to_you too
Fixes: https://gitlab.freedesktop.org/xorg/lib/libice/issues/4 Reported-by: mahendra <mahendra.n@samsung.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/connect.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/connect.c b/src/connect.c
index 1554ad6..821b727 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -236,6 +236,15 @@ IceOpenConnection (
iceConn->ping_waits = NULL;
iceConn->connect_to_you = malloc (sizeof (_IceConnectToYouInfo));
+ if (iceConn->connect_to_you == NULL)
+ {
+ _IceFreeConnection (iceConn);
+ if (errorStringRet && errorLength > 0) {
+ strncpy (errorStringRet, "Can't malloc", errorLength);
+ errorStringRet[errorLength - 1] = '\0';
+ }
+ return (NULL);
+ }
iceConn->connect_to_you->auth_active = 0;
/*