diff options
author | Stefan Fritsch <sf@apache.org> | 2010-07-27 22:09:45 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2010-07-27 22:09:45 +0000 |
commit | 443247b17081cb00b0e7f2f688889417cb45871f (patch) | |
tree | 1cb6ddc24a0845e85f254eec9056103e26b73d0b /file_io/unix | |
parent | 473c87316e7cf23eadb438189d2932b86ac8afae (diff) | |
download | apr-443247b17081cb00b0e7f2f688889417cb45871f.tar.gz |
Fix various issues found by cppcheck
- error handling issues
- use of uninitialized data
- null pointer dereference
- unused variables
- memory/fd leaks
- broken code in threadproc/beos/proc.c
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@979891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix')
-rw-r--r-- | file_io/unix/open.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/file_io/unix/open.c b/file_io/unix/open.c index ce4378577..ba271cb05 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -180,13 +180,17 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, if (!(flag & APR_FOPEN_NOCLEANUP)) { int flags; - if ((flags = fcntl(fd, F_GETFD)) == -1) + if ((flags = fcntl(fd, F_GETFD)) == -1) { + close(fd); return errno; + } if ((flags & FD_CLOEXEC) == 0) { flags |= FD_CLOEXEC; - if (fcntl(fd, F_SETFD, flags) == -1) + if (fcntl(fd, F_SETFD, flags) == -1) { + close(fd); return errno; + } } } |