summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Sesterhenn <eric.sesterhenn@lsexperts.de>2009-10-19 09:53:18 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-10-19 09:53:18 -0700
commit7d98b9b03c5fd5a82f9f4d215b10c0926edeab00 (patch)
tree1aaa19f49391393f8527d75c904f02c19793c57f
parent1127b8ec766ed8c48cc49b0779647fb697a07ebd (diff)
Bug 24612: Memory & fd leaks in local transports
X.Org bug #24612 <http://bugs.freedesktop.org/show_bug.cgi?id=24612> Patch #30548 <http://bugs.freedesktop.org/attachment.cgi?id=30548> Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--Xtranslcl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Xtranslcl.c b/Xtranslcl.c
index 8391156..cb5836c 100644
--- a/Xtranslcl.c
+++ b/Xtranslcl.c
@@ -163,6 +163,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) {
PRMSG(1, "FillAddrInfo: path too long\n", 0, 0, 0);
+ xfree((char *) sunaddr);
return 0;
}
strcpy (sunaddr->sun_path, sun_path);
@@ -190,6 +191,7 @@ TRANS(FillAddrInfo)(XtransConnInfo ciptr, char *sun_path, char *peer_sun_path)
if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) {
PRMSG(1, "FillAddrInfo: peer path too long\n", 0, 0, 0);
+ xfree((char *) p_sunaddr);
return 0;
}
strcpy (p_sunaddr->sun_path, peer_sun_path);
@@ -352,6 +354,7 @@ TRANS(PTSOpenClient)(XtransConnInfo ciptr, char *port)
if ((fd = open(DEV_PTMX, O_RDWR)) < 0) {
PRMSG(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX, 0,0);
+ close(server);
return(-1);
}
@@ -1126,6 +1129,10 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
if ((fds = open(DEV_SPX, O_RDWR)) < 0 ||
(fdr = open(DEV_SPX, O_RDWR)) < 0 ) {
PRMSG(1,"SCOOpenServer: failed to open %s\n", DEV_SPX, 0,0 );
+ if (fds >= 0)
+ close(fds);
+ if (fdr >= 0)
+ close(fdr);
return -1;
}
@@ -1165,7 +1172,7 @@ TRANS(SCOOpenServer)(XtransConnInfo ciptr, char *port)
}
fdr = open (serverR_path, O_RDWR | O_NDELAY);
- if (fds < 0) {
+ if (fdr < 0) {
PRMSG(1,"SCOOpenServer: failed to open %s\n", serverR_path, 0, 0);
close (fds);
return -1;