From ff992be7b05483f9a0586a27ee0edb6d99580b84 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 1 Dec 2011 12:04:22 +0000 Subject: Fix some resource & memory leaks in libxtrans. Signed-off-by: Alan Hourihane Reviewed-by: Alan Coopersmith Signed-off-by: Alan Coopersmith --- Xtransutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Xtransutil.c') 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) -- cgit v1.2.1