diff options
Diffstat (limited to 'X11/xtrans/Xtranssock.c')
-rw-r--r-- | X11/xtrans/Xtranssock.c | 55 |
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"); |