[PATCH] Fix resource leaks in wrapper.c
- From
- Laszlo Papp <djszapi2@gmail.com>
- Date
- Oct 27, 2009, 03:53 UTC
- Message-ID
- <1256615635-4940-1-git-send-email-djszapi@archlinux.us>
Fix the following issues with the desired close tags:
[wrapper.c:276]: (error) Resource leak: fd [wrapper.c:291]: (error) Resource leak: fd
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> --- wrapper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/wrapper.c b/wrapper.c index c9be140..76ecf0a 100644 --- a/wrapper.c +++ b/wrapper.c @@ -266,7 +266,7 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern) fd = mkstemp(template); if (0 <= fd) return fd; - + close(fd); /* slow path */ /* some mkstemp implementations erase template on failure */ snprintf(template, limit, "%s/%s", @@ -284,7 +284,7 @@ int odb_pack_keep(char *name, size_t namesz, unsigned char *sha1) fd = open(name, O_RDWR|O_CREAT|O_EXCL, 0600); if (0 <= fd) return fd; - + close(fd); /* slow path */ safe_create_leading_directories(name); return open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
-- 1.6.5