summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xtrans.c1
-rw-r--r--Xtranssock.c3
-rw-r--r--Xtransutil.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/Xtrans.c b/Xtrans.c
index 522e543..6973ca5 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -549,6 +549,7 @@ TRANS(Reopen) (int type, int trans_id, int fd, char *port)
if (ciptr == NULL)
{
prmsg (1,"Reopen: transport open failed\n");
+ xfree(save_port);
return NULL;
}
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;
diff --git a/Xtransutil.c b/Xtransutil.c
index 5dd2453..dd36cae 100644
--- a/Xtransutil.c
+++ b/Xtransutil.c
@@ -586,6 +586,7 @@ trans_mkdir(const char *path, int mode)
if (fstat(fd, &fbuf) == -1) {
prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n",
path, errno);
+ close(fd);
return -1;
}
/*
@@ -597,6 +598,7 @@ trans_mkdir(const char *path, int mode)
buf.st_ino != fbuf.st_ino) {
prmsg(1, "mkdir: ERROR: inode for %s changed\n",
path);
+ close(fd);
return -1;
}
if (updateOwner && fchown(fd, 0, 0) == 0)