libtt: Fixes for Coverity fixes that I thought I'd already fixed.
authorPeter Howkins <flibble@users.sf.net>
Mon, 23 Apr 2018 23:05:56 +0000 (00:05 +0100)
committerPeter Howkins <flibble@users.sf.net>
Mon, 23 Apr 2018 23:05:56 +0000 (00:05 +0100)
cde/lib/tt/lib/api/c/api_storage.h
cde/lib/tt/lib/db/tt_client_isam_file.C
cde/lib/tt/lib/mp/mp_auth.C
cde/lib/tt/lib/util/tt_audit.C
cde/lib/tt/lib/util/tt_log.C
cde/lib/tt/mini_isam/isfcb.c
cde/lib/tt/mini_isam/isrepair.c
cde/lib/tt/slib/mp_signature.C

index 1718127f6217c556337735173c5107f376b8c31f..b5563560d605d6e50877653e8e01dc23588b7d6d 100644 (file)
@@ -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;
index c11fab739f89878985f989b1e074af7b8be5c23e..28a095908e7835f15876e8d0cc371cd3eb5bfc42 100644 (file)
@@ -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 {
index b847ba4f043944fd3f7a71114481cdf21f378395..dcad344fa37c70b16a13974018f60d5cb523ef80 100644 (file)
@@ -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;
     }
 
index a16c41fcd6976874c92f4ee471ff6c03d0d505cf..635b4ea5fff8b4243f6b8062a5330811daf511c4 100644 (file)
@@ -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 {
index 58a49380a22e803a6720f08fe3cc0a298b1bb37d..bec979745e323d19cc3379b7ffe2d3c29f9d911d 100644 (file)
@@ -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;
        }
 
index cf810b4e90de4e76c4c7481382a2fcde4069276f..03c32f8f163b53bd50e3141988042d4830244626 100644 (file)
@@ -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);
index 531a4759043e2117df829e392749328e95d1fc9a..68c6b459424722f01c8a57a283d9749207fadd07 100644 (file)
@@ -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:
index 6198d85a7d084885c81e7985473cea4ccdc94951..f9d12965249b3f062437cc632ff057a75e9ad3cd 100644 (file)
@@ -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::