diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-07-03 16:41:02 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-07-03 16:41:02 +0200 |
commit | 5a8549c6edd0b18fa2315045622bca0f91853796 (patch) | |
tree | 4623aec4206d9338e5bcf16a2b71c8898632df80 /nx-X11/lib/include | |
parent | fd9de0086d10ee236dd24d51d93f60edf52cd89c (diff) | |
parent | 5651680bbde34de2713d06e868416145e269cb7c (diff) | |
download | nx-libs-5a8549c6edd0b18fa2315045622bca0f91853796.tar.gz nx-libs-5a8549c6edd0b18fa2315045622bca0f91853796.tar.bz2 nx-libs-5a8549c6edd0b18fa2315045622bca0f91853796.zip |
Merge branch 'mjtrangoni-WIP-add-cppcheck' into 3.6.x
Attributes GH PR #678: https://github.com/ArcticaProject/nx-libs/pull/678
Diffstat (limited to 'nx-X11/lib/include')
-rw-r--r-- | nx-X11/lib/include/xtrans/Xtrans.c | 13 | ||||
-rw-r--r-- | nx-X11/lib/include/xtrans/Xtranssock.c | 5 |
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; } |