From 9088d6b54e54cc24ded30aa49d2cb756341f52eb Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Tue, 24 Apr 2018 00:05:56 +0100 Subject: [PATCH] libtt: Fixes for Coverity fixes that I thought I'd already fixed. --- cde/lib/tt/lib/api/c/api_storage.h | 2 +- cde/lib/tt/lib/db/tt_client_isam_file.C | 5 +++++ cde/lib/tt/lib/mp/mp_auth.C | 1 + cde/lib/tt/lib/util/tt_audit.C | 1 + cde/lib/tt/lib/util/tt_log.C | 1 + cde/lib/tt/mini_isam/isfcb.c | 1 - cde/lib/tt/mini_isam/isrepair.c | 1 + cde/lib/tt/slib/mp_signature.C | 1 + 8 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cde/lib/tt/lib/api/c/api_storage.h b/cde/lib/tt/lib/api/c/api_storage.h index 1718127f..b5563560 100644 --- a/cde/lib/tt/lib/api/c/api_storage.h +++ b/cde/lib/tt/lib/api/c/api_storage.h @@ -45,7 +45,7 @@ declare_ptr_to(_Tt_api_stg_stack) class _Tt_api_stg_stack_elm : public _Tt_object { public: - _Tt_api_stg_stack_elm() { addr = NULL; }; + _Tt_api_stg_stack_elm() { addr = NULL; entry_type = STACK_MARK; }; ~_Tt_api_stg_stack_elm(); enum {STACK_MARK, STACK_STORAGE} entry_type; caddr_t addr; diff --git a/cde/lib/tt/lib/db/tt_client_isam_file.C b/cde/lib/tt/lib/db/tt_client_isam_file.C index c11fab73..28a09590 100644 --- a/cde/lib/tt/lib/db/tt_client_isam_file.C +++ b/cde/lib/tt/lib/db/tt_client_isam_file.C @@ -52,6 +52,9 @@ _Tt_client_isam_file::_Tt_client_isam_file (const _Tt_string &file, else { getStatusInfo(); } + + maxRecordLength = 0; + minRecordLength = 0; } _Tt_client_isam_file @@ -82,6 +85,8 @@ _Tt_client_isam_file } if (fileDescriptor != -1) { + currentRecordLength = 0; + currentRecordNumber = 0; getISAMFileInfo(); } else { diff --git a/cde/lib/tt/lib/mp/mp_auth.C b/cde/lib/tt/lib/mp/mp_auth.C index b847ba4f..dcad344f 100644 --- a/cde/lib/tt/lib/mp/mp_auth.C +++ b/cde/lib/tt/lib/mp/mp_auth.C @@ -280,6 +280,7 @@ write_auth_file(char *filename) _tt_syslog(0, LOG_ERR, "%s: unable to open tmp file \"%s\"\n", funcname, tmpnam); + free(tmpnam); return TT_AUTHFILE_ACCESS; } diff --git a/cde/lib/tt/lib/util/tt_audit.C b/cde/lib/tt/lib/util/tt_audit.C index a16c41fc..635b4ea5 100644 --- a/cde/lib/tt/lib/util/tt_audit.C +++ b/cde/lib/tt/lib/util/tt_audit.C @@ -527,6 +527,7 @@ entry(const char *argskey, _Tt_entry_pt func, ...) if (arg_index < 0 || msg_args.is_null() || msg_args->count() <= arg_index) { + va_end(ap); return TT_ERR_NUM; } } else { diff --git a/cde/lib/tt/lib/util/tt_log.C b/cde/lib/tt/lib/util/tt_log.C index 58a49380..bec97974 100644 --- a/cde/lib/tt/lib/util/tt_log.C +++ b/cde/lib/tt/lib/util/tt_log.C @@ -78,6 +78,7 @@ _tt_log_error(int errno, int line, char *file, char *msg) } /* Close on exec */ if(fcntl(fileno(fl), F_SETFD, 1) == -1) { + fclose(fl); return; } diff --git a/cde/lib/tt/mini_isam/isfcb.c b/cde/lib/tt/mini_isam/isfcb.c index cf810b4e..03c32f8f 100644 --- a/cde/lib/tt/mini_isam/isfcb.c +++ b/cde/lib/tt/mini_isam/isfcb.c @@ -648,7 +648,6 @@ _create_datfile(isfname) fd = open (namebuf, O_CREAT | O_EXCL | O_RDWR, 0666); if (fd > -1) { - fcntl(fd, F_SETFD, 1); /* Close on exec */ /* Close on exec */ if(fcntl(fd, F_SETFD, 1) == -1) { close(fd); diff --git a/cde/lib/tt/mini_isam/isrepair.c b/cde/lib/tt/mini_isam/isrepair.c index 531a4759..68c6b459 100644 --- a/cde/lib/tt/mini_isam/isrepair.c +++ b/cde/lib/tt/mini_isam/isrepair.c @@ -318,6 +318,7 @@ isrepair(isfname, verbose) (void)sigprocmask(SIG_SETMASK, &oldmask, NULL); print("...File repaired\n"); + if (buffer != Buffer) free(buffer); return (ISOK); ERROR: diff --git a/cde/lib/tt/slib/mp_signature.C b/cde/lib/tt/slib/mp_signature.C index 6198d85a..f9d12965 100644 --- a/cde/lib/tt/slib/mp_signature.C +++ b/cde/lib/tt/slib/mp_signature.C @@ -97,6 +97,7 @@ _Tt_signature(_Tt_signature_ptr sig) _otid = sig->_otid; _super_otid = sig->_super_otid; _timestamp = sig->_timestamp; + ce_entry = NULL; } bool_t _Tt_signature:: -- 2.25.1