aboutsummaryrefslogtreecommitdiff
path: root/X11/xtrans/Xtranssock.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-12-12 14:26:41 +0100
committermarha <marha@users.sourceforge.net>2011-12-12 14:26:41 +0100
commit2b5652fc7742c5ac57aca701214b046626a729e9 (patch)
treea994b9e63a32a7c061bcfb563aa22369c217e49c /X11/xtrans/Xtranssock.c
parent2331d6e4ac699e775ccee07a8a461cae0a98033a (diff)
parent5efb0a5e19b75137b7294b27f4e7878aeb8f0927 (diff)
downloadvcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.tar.gz
vcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.tar.bz2
vcxsrv-2b5652fc7742c5ac57aca701214b046626a729e9.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'X11/xtrans/Xtranssock.c')
-rw-r--r--X11/xtrans/Xtranssock.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index dff33f323..bb7ece4c2 100644
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -323,7 +323,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr)
* Everything looks good: fill in the XtransConnInfo structure.
*/
- if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
+ if ((ciptr->addr = malloc (namelen)) == NULL)
{
prmsg (1,
"SocketINETGetAddr: Can't allocate space for the addr\n");
@@ -390,7 +390,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr)
* Everything looks good: fill in the XtransConnInfo structure.
*/
- if ((ciptr->peeraddr = (char *) xalloc (namelen)) == NULL)
+ if ((ciptr->peeraddr = malloc (namelen)) == NULL)
{
prmsg (1,
"SocketINETGetPeerAddr: Can't allocate space for the addr\n");
@@ -412,8 +412,7 @@ TRANS(SocketOpen) (int i, int type)
prmsg (3,"SocketOpen(%d,%d)\n", i, type);
- if ((ciptr = (XtransConnInfo) xcalloc (
- 1, sizeof(struct _XtransConnInfo))) == NULL)
+ if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
prmsg (1, "SocketOpen: malloc failed\n");
return NULL;
@@ -433,7 +432,7 @@ TRANS(SocketOpen) (int i, int type)
prmsg (2, "SocketOpen: socket() failed for %s\n",
Sockettrans2devtab[i].transname);
- xfree ((char *) ciptr);
+ free (ciptr);
return NULL;
}
@@ -489,8 +488,7 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
}
#endif /*SOCK_MAXADDRLEN*/
- if ((ciptr = (XtransConnInfo) xcalloc (
- 1, sizeof(struct _XtransConnInfo))) == NULL)
+ if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
prmsg (1, "SocketReopen: malloc(ciptr) failed\n");
return NULL;
@@ -498,15 +496,18 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
ciptr->fd = fd;
- if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
+ if ((addr = calloc (1, portlen + 2)) == NULL) {
prmsg (1, "SocketReopen: malloc(addr) failed\n");
+ free (ciptr);
return NULL;
}
ciptr->addr = (char *) addr;
ciptr->addrlen = portlen + 2;
- if ((ciptr->peeraddr = (char *) xcalloc (1, portlen + 2)) == NULL) {
+ if ((ciptr->peeraddr = calloc (1, portlen + 2)) == NULL) {
prmsg (1, "SocketReopen: malloc(portaddr) failed\n");
+ free (addr);
+ free (ciptr);
return NULL;
}
ciptr->peeraddrlen = portlen + 2;
@@ -1143,7 +1144,7 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port,
namelen = sizeof (sockname); /* this will always make it the same size */
- if ((ciptr->addr = (char *) xalloc (namelen)) == NULL)
+ if ((ciptr->addr = malloc (namelen)) == NULL)
{
prmsg (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n");
@@ -1261,8 +1262,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
prmsg (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd);
- if ((newciptr = (XtransConnInfo) xcalloc (
- 1, sizeof(struct _XtransConnInfo))) == NULL)
+ if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
prmsg (1, "SocketINETAccept: malloc failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -1276,7 +1276,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
errno = WSAGetLastError();
#endif
prmsg (1, "SocketINETAccept: accept() failed\n");
- xfree (newciptr);
+ free (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
}
@@ -1303,7 +1303,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
prmsg (1,
"SocketINETAccept: ...SocketINETGetAddr() failed:\n");
close (newciptr->fd);
- xfree (newciptr);
+ free (newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
@@ -1313,8 +1313,8 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
prmsg (1,
"SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n");
close (newciptr->fd);
- if (newciptr->addr) xfree (newciptr->addr);
- xfree (newciptr);
+ if (newciptr->addr) free (newciptr->addr);
+ free (newciptr);
*status = TRANS_ACCEPT_MISC_ERROR;
return NULL;
}
@@ -1338,8 +1338,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
prmsg (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd);
- if ((newciptr = (XtransConnInfo) xcalloc (
- 1, sizeof(struct _XtransConnInfo))) == NULL)
+ if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
prmsg (1, "SocketUNIXAccept: malloc() failed\n");
*status = TRANS_ACCEPT_BAD_MALLOC;
@@ -1350,7 +1349,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
(struct sockaddr *) &sockname, (void *)&namelen)) < 0)
{
prmsg (1, "SocketUNIXAccept: accept() failed\n");
- xfree (newciptr);
+ free (newciptr);
*status = TRANS_ACCEPT_FAILED;
return NULL;
}
@@ -1361,12 +1360,12 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
* since this is unix domain.
*/
- if ((newciptr->addr = (char *) xalloc (ciptr->addrlen)) == NULL)
+ if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL)
{
prmsg (1,
"SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
- xfree (newciptr);
+ free (newciptr);
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -1379,13 +1378,13 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
newciptr->addrlen = ciptr->addrlen;
memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen);
- if ((newciptr->peeraddr = (char *) xalloc (ciptr->addrlen)) == NULL)
+ if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL)
{
prmsg (1,
"SocketUNIXAccept: Can't allocate space for the addr\n");
close (newciptr->fd);
- if (newciptr->addr) xfree (newciptr->addr);
- xfree (newciptr);
+ if (newciptr->addr) free (newciptr->addr);
+ free (newciptr);
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
}
@@ -1563,7 +1562,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
" socketfor IPv4 address\n");
}
if (newciptr)
- xfree(newciptr);
+ free(newciptr);
} else {
socketaddr = NULL;
prmsg (4,"SocketINETConnect Skipping IPv4 address\n");
@@ -1599,7 +1598,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
"socket for IPv6 address\n");
}
if (newciptr)
- xfree(newciptr);
+ free(newciptr);
}
else
{
@@ -2062,8 +2061,8 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port)
* since this is unix domain.
*/
- if ((ciptr->addr = (char *) xalloc(namelen)) == NULL ||
- (ciptr->peeraddr = (char *) xalloc(namelen)) == NULL)
+ if ((ciptr->addr = malloc(namelen)) == NULL ||
+ (ciptr->peeraddr = malloc(namelen)) == NULL)
{
prmsg (1,
"SocketUNIXCreateListener: Can't allocate space for the addr\n");