diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-24 14:36:10 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-24 14:36:10 -0700 |
commit | 2318ace3340009c44e78eab094f159f0e0b4a197 (patch) | |
tree | 1b953d835802a738ba0232621e1d90396a7c4c8f | |
parent | b484311c929a1b64966d89da92fafce7263006e1 (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.c | 9 |
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; /* |