dtmail: resolve 'deference before null check' errors related to if(!NULL) checks...
authorPeter Howkins <flibble@users.sf.net>
Mon, 2 Apr 2018 19:29:28 +0000 (20:29 +0100)
committerPeter Howkins <flibble@users.sf.net>
Mon, 2 Apr 2018 19:29:28 +0000 (20:29 +0100)
27 files changed:
cde/programs/dtmail/dtmail/AliasListUiItem.C
cde/programs/dtmail/dtmail/AlternatesListUiItem.C
cde/programs/dtmail/dtmail/AntiCheckBoxUiItem.C
cde/programs/dtmail/dtmail/CheckBoxUiItem.C
cde/programs/dtmail/dtmail/CheckForMailUiItem.C
cde/programs/dtmail/dtmail/DmxMessage.C
cde/programs/dtmail/dtmail/DmxPrintJob.C
cde/programs/dtmail/dtmail/Editor.C
cde/programs/dtmail/dtmail/EncryptedTextFieldUiItem.C
cde/programs/dtmail/dtmail/Fonts.C
cde/programs/dtmail/dtmail/InboxTextFieldUiItem.C
cde/programs/dtmail/dtmail/MailRetrievalOptions.C
cde/programs/dtmail/dtmail/MoveMenuListUiItem.C
cde/programs/dtmail/dtmail/RoamApp.C
cde/programs/dtmail/dtmail/RoamMenuWindow.C
cde/programs/dtmail/dtmail/ScaleUiItem.C
cde/programs/dtmail/dtmail/SendMsgDialog.C
cde/programs/dtmail/dtmail/SpinBoxUiItem.C
cde/programs/dtmail/dtmail/WMSaveSession.C
cde/programs/dtmail/dtmail/options_util.C
cde/programs/dtmail/dtmailpr/message.C
cde/programs/dtmail/libDtMail/Common/Session.C
cde/programs/dtmail/libDtMail/RFC/MIMEBodyPart.C
cde/programs/dtmail/libDtMail/RFC/RFCMailBox.C
cde/programs/dtmail/libDtMail/RFC/RFCMailValues.C
cde/programs/dtmail/libDtMail/RFC/SunV3.C
cde/programs/dtmail/libDtMail/RFC/V3BodyPart.C

index da054c8c75d3596a90dbc75883f51617f58a4092..b7b254c235a777ddb928340d9627c78c0fa2cad3 100644 (file)
@@ -217,8 +217,7 @@ void AliasListUiItem::writeFromSourceToUi()
       for (i = 0; i < list_len; i++)
        list_items->append(prop_pairs[i]);
 
-      if (NULL != prop_pairs)
-        XtFree((char*) prop_pairs);
+      XtFree((char*) prop_pairs);
   }
 
   for (i = 0; i < list_len; i++)
index 3745f769991b421bc727c549189d47dc62f70bf0..6d7b334f5ecae69547419c2f9c9d1e4967847ff3 100644 (file)
@@ -210,8 +210,7 @@ void AlternatesListUiItem::writeFromSourceToUi()
 
   delete char_list;
 
-  if(list_str != NULL)
-    free((void *)list_str);
+  free((void *)list_str);
 
   if(buf != NULL)
     free((void *)buf);
index 0a7066776a11e5565d8d3e1e09418902363af8fc..ab36078cb0d276aaf5cf60f60003a7df4a425b66 100644 (file)
@@ -94,13 +94,12 @@ void AntiCheckBoxUiItem::writeFromSourceToUi()
   //
   // This assumes that a non-null value means that the 
   // value is set and that a non-null means turn on the CB
-  if (strcmp(value, "f") == 0)
+  if (value && strcmp(value, "f") == 0)
     options_checkbox_set_value(w, TRUE, this->dirty_bit);
   else if (value == NULL || strcmp(value, "") == 0)
     options_checkbox_set_value(w, FALSE, this->dirty_bit);
   
-  if (value != NULL)
-    free((void*) value);
+  free(value);
 }
 
 
index 468a41bc783cdcd956a2557cb01238bee8b937f2..c6053021187927036f840ad0f9aae595cbc340fc 100644 (file)
@@ -97,8 +97,7 @@ void CheckBoxUiItem::writeFromSourceToUi()
   else if (NULL == value || strcmp(value, "f") == 0)
     options_checkbox_set_value(w, FALSE, this->dirty_bit);
   
-  if (value != NULL)
-    free((void*) value);
+  free((void*) value);
 }
 
 
index 8441d5c5df853a82afcdfe1902bf47105406792a..59397c3a1e2f4af7671da180ef0624fec3600b42 100644 (file)
@@ -115,5 +115,5 @@ void CheckForMailUiItem::writeFromSourceToUi()
     options_spinbox_set_value(w, atoi(value), this->dirty_bit);
     _valueChanged = FALSE;
 
-    if (NULL != value) free((void*) value);
+    free((void*) value);
 }
index 5b6dafc93ee7829efbef69ffd3b30bd99bf1349c..0c6ed6e6fa994130944495673570780037e3bb68 100644 (file)
@@ -394,8 +394,7 @@ DmxMsg::display (
        strcpy(v3_cs, "DEFAULT");
        strcat(v3_cs, ".");
        strcat(v3_cs, ret);
-       if (ret)
-         free(ret);
+       free(ret);
     }
 
     // Get iconv from and to codeset and do conversion.
index ad15d0ec911e898db84ab3d7990c69d261b73f02..0b4d33cacdca93d8b4e90cccb7111ec03ebd2401 100644 (file)
@@ -630,8 +630,7 @@ DmxPrintJob::loadOutputWidgets(void)
                _print_output->appendNewLine();
 
                XtFree(buffer);
-               if (NULL != separator_string)
-                 free((void*) separator_string);
+               free((void*) separator_string);
                
                break;
            }
index c653685409070945598f14d816acc0a0ede687e0..6dc80cede9f0b786aaacbba1e750ecb0a9457fd5 100644 (file)
@@ -435,8 +435,7 @@ Editor::update_display_from_props(void)
     mailrc->getValue(error, "toolcols", &value);
     if (!error.isSet()){
         cols = (int) strtol(value, NULL, 10);      
-        if (NULL != value)
-          free((void*) value);
+        free((void*) value);
     } else {
        /*
         * MB_CUR_MAX == 1 : SingleByteLanguage
index b9177cd19a3d313373e02d86e69a3703c827afcd..e2d79427eb5c779532673de551abbfc78d81c929 100644 (file)
@@ -138,7 +138,7 @@ void EncryptedTextFieldUiItem::writeFromSourceToUi()
 
     _loading = DTM_TRUE;
     options_field_set_value(w, value, this->dirty_bit);
-    if (NULL != value) free((void*) value);
+    free((void*) value);
     _loading = DTM_FALSE;
 }
 
index 9452114f829bbba516970ee72511a0f0fd46f184..cf3d8c1addd0fa345f95cf05ce6041fe529ac640 100644 (file)
@@ -101,8 +101,7 @@ get_font(
                    do_break = True;
                }
 
-               if (fl_entry_font_tag != NULL)
-                 XtFree((char*) fl_entry_font_tag);
+               XtFree((char*) fl_entry_font_tag);
 
                if (do_break)
                  break;
index 057d5544bd169e300eae77ca2a0b5f6a09d32094..9875d09366fd1bbee35d1da474a16ec417cfca43 100644 (file)
@@ -85,7 +85,7 @@ void InboxTextFieldUiItem::writeFromUiToSource()
     else
       prop_source->setValue(value);
 
-    if (NULL != mailspool_file) free((void*) mailspool_file);
+    free((void*) mailspool_file);
 }
 
 // Takes values in the UI and puts them into the source DB
@@ -114,6 +114,6 @@ void InboxTextFieldUiItem::writeFromSourceToUi()
     else
       options_field_set_value(w, value, this->dirty_bit);
 
-    if (NULL != value) free((void*) value);
+    free((void*) value);
     if (NULL != mailspool_file) free((void*) mailspool_file);
 }
index 41b881e5e909246ab892f19e706def8e498cf1a1..1c7f64041126b29b61dffba52daf95b8efbaf8a9 100644 (file)
@@ -822,7 +822,7 @@ MailRetrievalOptions::isValidInboxPath(PropUiItem* pui, void* data)
       errmsg = NULL;
 
     if (inbox_path) free(inbox_path);
-    if (expanded_path) free(expanded_path);
+    free(expanded_path);
     return (char*) errmsg;
 }
 
index 47556b26e14f45cd9fe63eb28bc5458e88e5b47c..02f6fe884de027d25131fba1be0e5f567fde14ee 100644 (file)
@@ -228,8 +228,7 @@ void MoveMenuListUiItem::writeFromSourceToUi()
 
   delete char_list;
   
-  if(list_str != NULL)
-      free((void*) list_str);
+  free((void*) list_str);
 
   if(buf != NULL)
       free((void *)buf);
index 99f21bf336c6abb5a4d44123f55e367db275c29c..88680d948bb3a1ff45ee7cf9243bfd0e85624063 100644 (file)
@@ -723,7 +723,7 @@ tooltalk_msg_handler(
                                        &file);
                }
 
-               if (str) free(str);
+               free(str);
 
                if (NULL == file)
                {
index 446c89a576451e74347a54fab37382ade7e0ae93..c0b7357a47c6e844e12f7057dd3417ac9b5a27d8 100644 (file)
@@ -421,8 +421,7 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
     else
       _inbox = FALSE;
 
-    if (NULL != mail_file)
-      free((void*)mail_file);
+    free((void*)mail_file);
 
     _list      = NULL;
     _genDialog  = NULL;
@@ -465,7 +464,7 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
     else
       _last_sorted_by = (SortBy) atoi(value);
 
-    if (NULL != value) free((void*) value);
+    free((void*) value);
     if (NULL != buffer) XtFree(buffer);
 
 }
@@ -788,7 +787,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
 
     int header_lines = (int) strtol(value, NULL, 10);
     _list->visibleItems(header_lines);
-    if (NULL != value) free((void*) value);
+    free((void*) value);
 
     XtAddCallback(
        _list->get_scrolling_list(), XmNhelpCallback, 
@@ -1863,8 +1862,7 @@ RoamMenuWindow::propsChanged(void)
     if (header_lines != _list->visibleItems())
        _list->visibleItems(header_lines);
 
-    if (NULL != value)
-      free((void*) value);
+    free((void*) value);
 
     _list->checkDisplayProp();
     _my_editor->textEditor()->update_display_from_props();
@@ -2788,7 +2786,7 @@ RoamMenuWindow::create_container_callback(void *client_data, char *selection)
 {
     RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
     obj->create_new_container(selection);
-    if (NULL != selection) XtFree(selection);
+    XtFree(selection);
 }
 
 void
@@ -5152,8 +5150,7 @@ RoamMenuWindow::addToCachedContainerList(char *filename)
                        &mail_file);
 
         is_inbox = (0 == strcmp(mail_file, filename));
-       if (NULL != mail_file)
-         free((void*) mail_file);
+       free((void*) mail_file);
        if (is_inbox)
          return;
 
index 19b5f9b2d55cf79581185d9589f470fe915a4a2a..73a32c5d0eca3ea27afbf9ea90c19920a49ba2b4 100644 (file)
@@ -85,6 +85,5 @@ void ScaleUiItem::writeFromSourceToUi()
 
   options_scale_set_value(w, value, this->dirty_bit);
 
-  if (NULL != value)
-    free((void*) value);
+  free((void*) value);
 }
index 473853dcb5fac2d63b4c15e45d810f57b8c915d1..310adfbf01c7e6463eddd70354f46884508d1f12 100644 (file)
@@ -915,9 +915,7 @@ SendMsgDialog::storeHeaders(DtMail::Message * input)
        else {
            env->removeHeader(error, hl->header);
        }
-       if (value) {
-               XtFree(value);
-        }
+       XtFree(value);
     }
 }
 
@@ -1727,9 +1725,7 @@ SendMsgDialog::include_file_cb( void *client_data, char *selection )
 {
     SendMsgDialog *obj = (SendMsgDialog *)client_data;
     obj->include_file(selection);
-    if (NULL != selection)
-      XtFree(selection);
-    
+    XtFree(selection);
 }
 
 void
index 25a34c7a436faa3771cb2c10496817a15e73c28b..94512b513182dd49176ab2ca320624d5bd48fa15 100644 (file)
@@ -86,8 +86,7 @@ void SpinBoxUiItem::writeFromSourceToUi()
 
   options_spinbox_set_value(w, atoi(value), this->dirty_bit);
 
-  if (NULL != value)
-    free((void*) value);
+  free((void*) value);
 }
 
 
index a0348e5ffe5ab2e72dae49e5136f8f795d560137..e348cc52546b98554fda01f2911173db460608ae 100644 (file)
@@ -181,8 +181,7 @@ RoamApp::openSessionFile(char *filename)
 
     LOG_FPRINTF(log, (log,"Opened session file: %s\n",pathname));
     LOG_CLOSEFILEPTR(log);
-    if (pathname != NULL)
-      XtFree((char *)pathname);
+    XtFree((char *)pathname);
 }
 
 /*
index b2bfd364231136911d53dae35e2ef326ed03a363..9cce108da9d1d41b76ba4e6a78e20c09a2c89726 100644 (file)
@@ -312,8 +312,8 @@ options_spinbox_modCB(
          cbs->doit = FALSE;
         XBell(dpy, 50);
      }
-     if (NULL != text) XtFree(text);
-     if (NULL != textvalue) XtFree(textvalue);
+     XtFree(text);
+     XtFree(textvalue);
 }
 
 void
index a1cc32c839499d746c9aa56d536ca5589aeb3b4f..314b34de8156681e9f34729a3a05f279131cbb23 100644 (file)
@@ -297,8 +297,7 @@ DmxMsg::display (void)
          strcpy(v3_cs, "DEFAULT");
          strcat(v3_cs, ".");
          strcat(v3_cs, ret);
-         if (ret)
-                free(ret);
+         free(ret);
    }
 
 // Get iconv from and to codeset and do conversion.
index 830a99724426dec9bb0d79995e2e59478bb9f31f..b1b387cb845d840a5b3394ebf0c7fc065ee2cd94 100644 (file)
@@ -1597,8 +1597,7 @@ DtMail::Session::targetTagName(char *special)
       NULL,
       &ret_codeset);
  
-   if (ret_locale)
-     free(ret_locale);
+   free(ret_locale);
    if (ret_lang)
      free(ret_lang);
    if (ret_target)
index 1e631140a3c5fd155d2b49b39ca49e0434a4b403..f352cadf7fc2c97099c20ca608bcf04f7fbb1a36 100644 (file)
@@ -382,8 +382,7 @@ MIMEBodyPart::getDtType(DtMailEnv & error)
       error.clear();
     if (type)
       DtDtsFreeDataType(type);
-    if (mime_type)
-      free(mime_type);
+    free(mime_type);
     if (name)
       free(name);
 }
@@ -510,7 +509,6 @@ MIMEBodyPart::loadBody(DtMailEnv & error)
          }
          }
        }
-       if ( cs )
        free ( cs );
        if ( from_cs )
            free( from_cs );
index 0b1409194d6f67e0e01e4ef2b254e409127deea7..3b0b98e37bc5ab97b24db77e0b52921fd27e3383 100644 (file)
@@ -4963,7 +4963,7 @@ RFCMailBox::createMailRetrievalAgent(char *password)
                                        appendCB, (void*) this);
 
         if (NULL != _mra_server) _mra_server->set_password(_mra_serverpw);
-        if (NULL != protocol) free(protocol);
+        free(protocol);
     }
     else if (True == DtMailServer::get_mailrc_value(
                                              _session, DTMAS_INBOX,
index 38d53ebfedc81671b1df5a393deac7f8a5454f24..23360212474f7a1093b5eb47b752c9ebe14fa0fc 100644 (file)
@@ -170,8 +170,7 @@ decode1522(const char * enc_start, const char * max_end, char **output, DtMail::
        free( from_cs );
     if (NULL != to_cs)
        free ( to_cs );
-    if (NULL != cs_name)
-       free(cs_name);
+    free(cs_name);
 
     return(enc_end);
 }
index f4a4c4bbdce73c118a4901053fe915c7d1017159..248048c83eeecf522a15dd8235b520e967d31856 100644 (file)
@@ -375,14 +375,12 @@ SunV3::formatBodies(DtMailEnv & error,
                delete [] cbuf;
                delete rd;
            }
-           if (bp_contents) {
-               free(bp_contents);
-               bp_contents = NULL;
-           }
-           if (name) {
-               free(name);
-               name = NULL;
-           }
+
+           free(bp_contents);
+           bp_contents = NULL;
+           
+           free(name);
+           name = NULL;
        }
     }
 
index 0d4fa1ba32e93cbb11f68d4cfe3398e81c8b1d5b..425f640a65890740384793452a82580c13615813 100644 (file)
@@ -590,8 +590,7 @@ V3BodyPart::loadBody(DtMailEnv &)
           strcpy(cs, "DEFAULT");
           strcat(cs, ".");
           strcat(cs, ret);
-           if ( ret )
-            free( ret );
+           free( ret );
        }
        }  // If cstmp is NULL