aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorMario Trangoni <mjtrangoni@gmail.com>2018-03-25 16:13:10 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-07-03 16:40:06 +0200
commit913fcf1a74426725f14380dd5b34286a21c37ab7 (patch)
tree70892161161325931ae5f1b444b277a4d9f0379d /nx-X11/lib
parentc58cbc26cc2a04fa06d22333ffe7ad52f7ede1fa (diff)
downloadnx-libs-913fcf1a74426725f14380dd5b34286a21c37ab7.tar.gz
nx-libs-913fcf1a74426725f14380dd5b34286a21c37ab7.tar.bz2
nx-libs-913fcf1a74426725f14380dd5b34286a21c37ab7.zip
Fix some memory leaks.
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/include/xtrans/Xtrans.c13
-rw-r--r--nx-X11/lib/include/xtrans/Xtranssock.c5
2 files changed, 9 insertions, 9 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;
}
diff --git a/nx-X11/lib/include/xtrans/Xtranssock.c b/nx-X11/lib/include/xtrans/Xtranssock.c
index a7470edcd..090a325ce 100644
--- a/nx-X11/lib/include/xtrans/Xtranssock.c
+++ b/nx-X11/lib/include/xtrans/Xtranssock.c
@@ -2442,19 +2442,18 @@ SocketUNIXConnectPost:
(ciptr->peeraddr = malloc(namelen)) == NULL)
{
prmsg (1,
- "SocketUNIXCreateListener: Can't allocate space for the addr\n");
+ "SocketUNIXCreateListener: Can't allocate space for the addr\n");
return TRANS_CONNECT_FAILED;
}
if (abstract)
- sockname.sun_path[0] = '@';
+ sockname.sun_path[0] = '@';
ciptr->family = AF_UNIX;
ciptr->addrlen = namelen;
ciptr->peeraddrlen = namelen;
memcpy (ciptr->addr, &sockname, ciptr->addrlen);
memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen);
-
return 0;
}