aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/include/xtrans/Xtrans.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/include/xtrans/Xtrans.c')
-rw-r--r--nx-X11/lib/include/xtrans/Xtrans.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/nx-X11/lib/include/xtrans/Xtrans.c b/nx-X11/lib/include/xtrans/Xtrans.c
index 328a970b1..033dd6cd7 100644
--- a/nx-X11/lib/include/xtrans/Xtrans.c
+++ b/nx-X11/lib/include/xtrans/Xtrans.c
@@ -980,16 +980,17 @@ TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
{
prmsg (1,"GetMyAddr: malloc failed\n");
return -1;
+ } else {
+ memcpy(*addrp, ciptr->addr, ciptr->addrlen);
+ free(addrp);
}
- memcpy(*addrp, ciptr->addr, ciptr->addrlen);
-
return 0;
}
#endif
int
TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
- Xtransaddr **addrp)
+ Xtransaddr **addrp)
{
prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd);
@@ -999,11 +1000,11 @@ TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp,
if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL)
{
- prmsg (1,"GetPeerAddr: malloc failed\n");
- return -1;
+ prmsg (1,"GetPeerAddr: malloc failed\n");
+ return -1;
}
memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen);
-
+ free(addrp);
return 0;
}