aboutsummaryrefslogtreecommitdiff
path: root/libxcb
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-25 15:37:13 +0000
committermarha <marha@users.sourceforge.net>2011-03-25 15:37:13 +0000
commit41a502478a2972358dec934d82ee401c61a5cd36 (patch)
tree3fda8100e6da9b4a2863789e393016a750502067 /libxcb
parent81aeaf653a832c4054d9a40b1cc796911521a739 (diff)
parent272e57235cd60a2e65ac8258d96a02eb3939b687 (diff)
downloadvcxsrv-41a502478a2972358dec934d82ee401c61a5cd36.tar.gz
vcxsrv-41a502478a2972358dec934d82ee401c61a5cd36.tar.bz2
vcxsrv-41a502478a2972358dec934d82ee401c61a5cd36.zip
svn merge ^/branches/released .
Diffstat (limited to 'libxcb')
-rw-r--r--libxcb/src/xcb_auth.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libxcb/src/xcb_auth.c b/libxcb/src/xcb_auth.c
index 8a868a4a1..5cfa9dc7c 100644
--- a/libxcb/src/xcb_auth.c
+++ b/libxcb/src/xcb_auth.c
@@ -262,7 +262,7 @@ static struct sockaddr *get_peer_sock_name(LPFN_GETPEERNAME socket_func,
{
socklen_t socknamelen = sizeof(struct sockaddr) + INITIAL_SOCKNAME_SLACK;
socklen_t actual_socknamelen = socknamelen;
- struct sockaddr *sockname = malloc(socknamelen), *new_sockname = NULL;
+ struct sockaddr *sockname = malloc(socknamelen);
if (sockname == NULL)
return NULL;
@@ -275,14 +275,17 @@ static struct sockaddr *get_peer_sock_name(LPFN_GETPEERNAME socket_func,
if (actual_socknamelen > socknamelen)
{
+ struct sockaddr *new_sockname = NULL;
socknamelen = actual_socknamelen;
- if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL ||
- socket_func(fd, new_sockname, &actual_socknamelen) == -1 ||
- actual_socknamelen > socknamelen)
+ if ((new_sockname = realloc(sockname, actual_socknamelen)) == NULL)
goto sock_or_realloc_error;
sockname = new_sockname;
+
+ if (socket_func(fd, sockname, &actual_socknamelen) == -1 ||
+ actual_socknamelen > socknamelen)
+ goto sock_or_realloc_error;
}
return sockname;