diff options
author | Volker Lendecke <vl@samba.org> | 2015-03-08 19:18:21 +0000 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2015-06-20 20:51:16 +0200 |
commit | 49fb6e7ac58db9c579e0c387e86a0b598434f042 (patch) | |
tree | 19576398090ae10c4c5b22a685842961f5e5f14a /lib | |
parent | a7cfaa8a01099219666fe656f45c86a472689c0d (diff) | |
download | samba-49fb6e7ac58db9c579e0c387e86a0b598434f042.tar.gz |
tdb: Fix CID 1034841 Resource leak
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
(cherry picked from commit 1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tdb/test/run-incompatible.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/tdb/test/run-incompatible.c b/lib/tdb/test/run-incompatible.c index b8e95b5e778..5f1b586f9cc 100644 --- a/lib/tdb/test/run-incompatible.c +++ b/lib/tdb/test/run-incompatible.c @@ -28,15 +28,17 @@ static void log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const ch static unsigned int hdr_rwlocks(const char *fname) { struct tdb_header hdr; + ssize_t nread; int fd = open(fname, O_RDONLY); if (fd == -1) return -1; - if (read(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) - return -1; - + nread = read(fd, &hdr, sizeof(hdr)); close(fd); + if (nread != sizeof(hdr)) { + return -1; + } return hdr.rwlocks; } |