dtmail: resolve 'deference before null check' errors related to if(!NULL) checks around free() calls
This commit is contained in:
@@ -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++)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -723,7 +723,7 @@ tooltalk_msg_handler(
|
||||
&file);
|
||||
}
|
||||
|
||||
if (str) free(str);
|
||||
free(str);
|
||||
|
||||
if (NULL == 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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user