summaryrefslogtreecommitdiff
path: root/Xtranssock.c
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@fairlite.co.uk>2011-12-01 12:04:22 +0000
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-05 20:34:12 -0800
commitff992be7b05483f9a0586a27ee0edb6d99580b84 (patch)
tree2beea8fe03848e12f43066bb30a55669853a3606 /Xtranssock.c
parent29c9e101f7ad72556aa6b3dbc17d66a1ace9b2b1 (diff)
Fix some resource & memory leaks in libxtrans.
Signed-off-by: Alan Hourihane <alanh@vmware.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Xtranssock.c')
-rw-r--r--Xtranssock.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Xtranssock.c b/Xtranssock.c
index 955516d..901d721 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -492,6 +492,7 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
prmsg (1, "SocketReopen: malloc(addr) failed\n");
+ xfree (ciptr);
return NULL;
}
ciptr->addr = (char *) addr;
@@ -499,6 +500,8 @@ TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, char *port)
if ((ciptr->peeraddr = (char *) xcalloc (1, portlen + 2)) == NULL) {
prmsg (1, "SocketReopen: malloc(portaddr) failed\n");
+ xfree (addr);
+ xfree (ciptr);
return NULL;
}
ciptr->peeraddrlen = portlen + 2;