From 8852315e574879a9548c31f84c6eaea59f1db90f Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sat, 9 Feb 2013 11:36:29 +0100 Subject: [PATCH] libatalk: Fix a couple of issues in ad_openat() Reported by coverity as CID #762151, #762127. --- libatalk/adouble/ad_open.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libatalk/adouble/ad_open.c b/libatalk/adouble/ad_open.c index 5aca77c0..a4a56b12 100644 --- a/libatalk/adouble/ad_open.c +++ b/libatalk/adouble/ad_open.c @@ -1824,10 +1824,12 @@ int ad_openat(struct adouble *ad, EC_INIT; int cwdfd = -1; va_list args; - mode_t mode; + mode_t mode = 0; if (dirfd != -1) { if ((cwdfd = open(".", O_RDONLY) == -1) || (fchdir(dirfd) != 0)) + if (cwdfd > 0) + close(cwdfd); EC_FAIL; } -- 2.39.2