diff options
author | Volker Lendecke <vl@samba.org> | 2015-03-08 19:18:21 +0000 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2015-03-10 21:48:04 +0100 |
commit | 1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8 (patch) | |
tree | 0d158ee9eeb32008088ace985380fcc92c65caa0 /lib | |
parent | a8c1ad55b5c93bcebb5e417eb95b740b5ead0045 (diff) | |
download | samba-1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8.tar.gz samba-1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8.tar.xz samba-1b8c07ac7d51eb2a1957d79ea05b170106a9c0e8.zip |
tdb: Fix CID 1034841 Resource leak
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
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 b8e95b5e77..5f1b586f9c 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; } |