mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtmail: resolve 'deference before null check' errors related to if(!NULL) checks around free() calls
This commit is contained in:
parent
8362f92ceb
commit
0b38496bd8
27 changed files with 41 additions and 68 deletions
|
@ -217,8 +217,7 @@ void AliasListUiItem::writeFromSourceToUi()
|
||||||
for (i = 0; i < list_len; i++)
|
for (i = 0; i < list_len; i++)
|
||||||
list_items->append(prop_pairs[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++)
|
for (i = 0; i < list_len; i++)
|
||||||
|
|
|
@ -210,8 +210,7 @@ void AlternatesListUiItem::writeFromSourceToUi()
|
||||||
|
|
||||||
delete char_list;
|
delete char_list;
|
||||||
|
|
||||||
if(list_str != NULL)
|
free((void *)list_str);
|
||||||
free((void *)list_str);
|
|
||||||
|
|
||||||
if(buf != NULL)
|
if(buf != NULL)
|
||||||
free((void *)buf);
|
free((void *)buf);
|
||||||
|
|
|
@ -94,13 +94,12 @@ void AntiCheckBoxUiItem::writeFromSourceToUi()
|
||||||
//
|
//
|
||||||
// This assumes that a non-null value means that the
|
// This assumes that a non-null value means that the
|
||||||
// value is set and that a non-null means turn on the CB
|
// 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);
|
options_checkbox_set_value(w, TRUE, this->dirty_bit);
|
||||||
else if (value == NULL || strcmp(value, "") == 0)
|
else if (value == NULL || strcmp(value, "") == 0)
|
||||||
options_checkbox_set_value(w, FALSE, this->dirty_bit);
|
options_checkbox_set_value(w, FALSE, this->dirty_bit);
|
||||||
|
|
||||||
if (value != NULL)
|
free(value);
|
||||||
free((void*) value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,7 @@ void CheckBoxUiItem::writeFromSourceToUi()
|
||||||
else if (NULL == value || strcmp(value, "f") == 0)
|
else if (NULL == value || strcmp(value, "f") == 0)
|
||||||
options_checkbox_set_value(w, FALSE, this->dirty_bit);
|
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);
|
options_spinbox_set_value(w, atoi(value), this->dirty_bit);
|
||||||
_valueChanged = FALSE;
|
_valueChanged = FALSE;
|
||||||
|
|
||||||
if (NULL != value) free((void*) value);
|
free((void*) value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,8 +394,7 @@ DmxMsg::display (
|
||||||
strcpy(v3_cs, "DEFAULT");
|
strcpy(v3_cs, "DEFAULT");
|
||||||
strcat(v3_cs, ".");
|
strcat(v3_cs, ".");
|
||||||
strcat(v3_cs, ret);
|
strcat(v3_cs, ret);
|
||||||
if (ret)
|
free(ret);
|
||||||
free(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get iconv from and to codeset and do conversion.
|
// Get iconv from and to codeset and do conversion.
|
||||||
|
|
|
@ -630,8 +630,7 @@ DmxPrintJob::loadOutputWidgets(void)
|
||||||
_print_output->appendNewLine();
|
_print_output->appendNewLine();
|
||||||
|
|
||||||
XtFree(buffer);
|
XtFree(buffer);
|
||||||
if (NULL != separator_string)
|
free((void*) separator_string);
|
||||||
free((void*) separator_string);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,8 +435,7 @@ Editor::update_display_from_props(void)
|
||||||
mailrc->getValue(error, "toolcols", &value);
|
mailrc->getValue(error, "toolcols", &value);
|
||||||
if (!error.isSet()){
|
if (!error.isSet()){
|
||||||
cols = (int) strtol(value, NULL, 10);
|
cols = (int) strtol(value, NULL, 10);
|
||||||
if (NULL != value)
|
free((void*) value);
|
||||||
free((void*) value);
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* MB_CUR_MAX == 1 : SingleByteLanguage
|
* MB_CUR_MAX == 1 : SingleByteLanguage
|
||||||
|
|
|
@ -138,7 +138,7 @@ void EncryptedTextFieldUiItem::writeFromSourceToUi()
|
||||||
|
|
||||||
_loading = DTM_TRUE;
|
_loading = DTM_TRUE;
|
||||||
options_field_set_value(w, value, this->dirty_bit);
|
options_field_set_value(w, value, this->dirty_bit);
|
||||||
if (NULL != value) free((void*) value);
|
free((void*) value);
|
||||||
_loading = DTM_FALSE;
|
_loading = DTM_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,7 @@ get_font(
|
||||||
do_break = True;
|
do_break = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fl_entry_font_tag != NULL)
|
XtFree((char*) fl_entry_font_tag);
|
||||||
XtFree((char*) fl_entry_font_tag);
|
|
||||||
|
|
||||||
if (do_break)
|
if (do_break)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -85,7 +85,7 @@ void InboxTextFieldUiItem::writeFromUiToSource()
|
||||||
else
|
else
|
||||||
prop_source->setValue(value);
|
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
|
// Takes values in the UI and puts them into the source DB
|
||||||
|
@ -114,6 +114,6 @@ void InboxTextFieldUiItem::writeFromSourceToUi()
|
||||||
else
|
else
|
||||||
options_field_set_value(w, value, this->dirty_bit);
|
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);
|
if (NULL != mailspool_file) free((void*) mailspool_file);
|
||||||
}
|
}
|
||||||
|
|
|
@ -822,7 +822,7 @@ MailRetrievalOptions::isValidInboxPath(PropUiItem* pui, void* data)
|
||||||
errmsg = NULL;
|
errmsg = NULL;
|
||||||
|
|
||||||
if (inbox_path) free(inbox_path);
|
if (inbox_path) free(inbox_path);
|
||||||
if (expanded_path) free(expanded_path);
|
free(expanded_path);
|
||||||
return (char*) errmsg;
|
return (char*) errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,8 +228,7 @@ void MoveMenuListUiItem::writeFromSourceToUi()
|
||||||
|
|
||||||
delete char_list;
|
delete char_list;
|
||||||
|
|
||||||
if(list_str != NULL)
|
free((void*) list_str);
|
||||||
free((void*) list_str);
|
|
||||||
|
|
||||||
if(buf != NULL)
|
if(buf != NULL)
|
||||||
free((void *)buf);
|
free((void *)buf);
|
||||||
|
|
|
@ -723,7 +723,7 @@ tooltalk_msg_handler(
|
||||||
&file);
|
&file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str) free(str);
|
free(str);
|
||||||
|
|
||||||
if (NULL == file)
|
if (NULL == file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -421,8 +421,7 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
|
||||||
else
|
else
|
||||||
_inbox = FALSE;
|
_inbox = FALSE;
|
||||||
|
|
||||||
if (NULL != mail_file)
|
free((void*)mail_file);
|
||||||
free((void*)mail_file);
|
|
||||||
|
|
||||||
_list = NULL;
|
_list = NULL;
|
||||||
_genDialog = NULL;
|
_genDialog = NULL;
|
||||||
|
@ -465,7 +464,7 @@ RoamMenuWindow::RoamMenuWindow (char *name) : MenuWindow ("dtmail", True)
|
||||||
else
|
else
|
||||||
_last_sorted_by = (SortBy) atoi(value);
|
_last_sorted_by = (SortBy) atoi(value);
|
||||||
|
|
||||||
if (NULL != value) free((void*) value);
|
free((void*) value);
|
||||||
if (NULL != buffer) XtFree(buffer);
|
if (NULL != buffer) XtFree(buffer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -788,7 +787,7 @@ RoamMenuWindow::createWorkArea(Widget parent)
|
||||||
|
|
||||||
int header_lines = (int) strtol(value, NULL, 10);
|
int header_lines = (int) strtol(value, NULL, 10);
|
||||||
_list->visibleItems(header_lines);
|
_list->visibleItems(header_lines);
|
||||||
if (NULL != value) free((void*) value);
|
free((void*) value);
|
||||||
|
|
||||||
XtAddCallback(
|
XtAddCallback(
|
||||||
_list->get_scrolling_list(), XmNhelpCallback,
|
_list->get_scrolling_list(), XmNhelpCallback,
|
||||||
|
@ -1863,8 +1862,7 @@ RoamMenuWindow::propsChanged(void)
|
||||||
if (header_lines != _list->visibleItems())
|
if (header_lines != _list->visibleItems())
|
||||||
_list->visibleItems(header_lines);
|
_list->visibleItems(header_lines);
|
||||||
|
|
||||||
if (NULL != value)
|
free((void*) value);
|
||||||
free((void*) value);
|
|
||||||
|
|
||||||
_list->checkDisplayProp();
|
_list->checkDisplayProp();
|
||||||
_my_editor->textEditor()->update_display_from_props();
|
_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;
|
RoamMenuWindow *obj = (RoamMenuWindow*) client_data;
|
||||||
obj->create_new_container(selection);
|
obj->create_new_container(selection);
|
||||||
if (NULL != selection) XtFree(selection);
|
XtFree(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5152,8 +5150,7 @@ RoamMenuWindow::addToCachedContainerList(char *filename)
|
||||||
&mail_file);
|
&mail_file);
|
||||||
|
|
||||||
is_inbox = (0 == strcmp(mail_file, filename));
|
is_inbox = (0 == strcmp(mail_file, filename));
|
||||||
if (NULL != mail_file)
|
free((void*) mail_file);
|
||||||
free((void*) mail_file);
|
|
||||||
if (is_inbox)
|
if (is_inbox)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,5 @@ void ScaleUiItem::writeFromSourceToUi()
|
||||||
|
|
||||||
options_scale_set_value(w, value, this->dirty_bit);
|
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 {
|
else {
|
||||||
env->removeHeader(error, hl->header);
|
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;
|
SendMsgDialog *obj = (SendMsgDialog *)client_data;
|
||||||
obj->include_file(selection);
|
obj->include_file(selection);
|
||||||
if (NULL != selection)
|
XtFree(selection);
|
||||||
XtFree(selection);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -86,8 +86,7 @@ void SpinBoxUiItem::writeFromSourceToUi()
|
||||||
|
|
||||||
options_spinbox_set_value(w, atoi(value), this->dirty_bit);
|
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_FPRINTF(log, (log,"Opened session file: %s\n",pathname));
|
||||||
LOG_CLOSEFILEPTR(log);
|
LOG_CLOSEFILEPTR(log);
|
||||||
if (pathname != NULL)
|
XtFree((char *)pathname);
|
||||||
XtFree((char *)pathname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -312,8 +312,8 @@ options_spinbox_modCB(
|
||||||
cbs->doit = FALSE;
|
cbs->doit = FALSE;
|
||||||
XBell(dpy, 50);
|
XBell(dpy, 50);
|
||||||
}
|
}
|
||||||
if (NULL != text) XtFree(text);
|
XtFree(text);
|
||||||
if (NULL != textvalue) XtFree(textvalue);
|
XtFree(textvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -297,8 +297,7 @@ DmxMsg::display (void)
|
||||||
strcpy(v3_cs, "DEFAULT");
|
strcpy(v3_cs, "DEFAULT");
|
||||||
strcat(v3_cs, ".");
|
strcat(v3_cs, ".");
|
||||||
strcat(v3_cs, ret);
|
strcat(v3_cs, ret);
|
||||||
if (ret)
|
free(ret);
|
||||||
free(ret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get iconv from and to codeset and do conversion.
|
// Get iconv from and to codeset and do conversion.
|
||||||
|
|
|
@ -1597,8 +1597,7 @@ DtMail::Session::targetTagName(char *special)
|
||||||
NULL,
|
NULL,
|
||||||
&ret_codeset);
|
&ret_codeset);
|
||||||
|
|
||||||
if (ret_locale)
|
free(ret_locale);
|
||||||
free(ret_locale);
|
|
||||||
if (ret_lang)
|
if (ret_lang)
|
||||||
free(ret_lang);
|
free(ret_lang);
|
||||||
if (ret_target)
|
if (ret_target)
|
||||||
|
|
|
@ -382,8 +382,7 @@ MIMEBodyPart::getDtType(DtMailEnv & error)
|
||||||
error.clear();
|
error.clear();
|
||||||
if (type)
|
if (type)
|
||||||
DtDtsFreeDataType(type);
|
DtDtsFreeDataType(type);
|
||||||
if (mime_type)
|
free(mime_type);
|
||||||
free(mime_type);
|
|
||||||
if (name)
|
if (name)
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +509,6 @@ MIMEBodyPart::loadBody(DtMailEnv & error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( cs )
|
|
||||||
free ( cs );
|
free ( cs );
|
||||||
if ( from_cs )
|
if ( from_cs )
|
||||||
free( from_cs );
|
free( from_cs );
|
||||||
|
|
|
@ -4963,7 +4963,7 @@ RFCMailBox::createMailRetrievalAgent(char *password)
|
||||||
appendCB, (void*) this);
|
appendCB, (void*) this);
|
||||||
|
|
||||||
if (NULL != _mra_server) _mra_server->set_password(_mra_serverpw);
|
if (NULL != _mra_server) _mra_server->set_password(_mra_serverpw);
|
||||||
if (NULL != protocol) free(protocol);
|
free(protocol);
|
||||||
}
|
}
|
||||||
else if (True == DtMailServer::get_mailrc_value(
|
else if (True == DtMailServer::get_mailrc_value(
|
||||||
_session, DTMAS_INBOX,
|
_session, DTMAS_INBOX,
|
||||||
|
|
|
@ -170,8 +170,7 @@ decode1522(const char * enc_start, const char * max_end, char **output, DtMail::
|
||||||
free( from_cs );
|
free( from_cs );
|
||||||
if (NULL != to_cs)
|
if (NULL != to_cs)
|
||||||
free ( to_cs );
|
free ( to_cs );
|
||||||
if (NULL != cs_name)
|
free(cs_name);
|
||||||
free(cs_name);
|
|
||||||
|
|
||||||
return(enc_end);
|
return(enc_end);
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,14 +375,12 @@ SunV3::formatBodies(DtMailEnv & error,
|
||||||
delete [] cbuf;
|
delete [] cbuf;
|
||||||
delete rd;
|
delete rd;
|
||||||
}
|
}
|
||||||
if (bp_contents) {
|
|
||||||
free(bp_contents);
|
free(bp_contents);
|
||||||
bp_contents = NULL;
|
bp_contents = NULL;
|
||||||
}
|
|
||||||
if (name) {
|
free(name);
|
||||||
free(name);
|
name = NULL;
|
||||||
name = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -590,8 +590,7 @@ V3BodyPart::loadBody(DtMailEnv &)
|
||||||
strcpy(cs, "DEFAULT");
|
strcpy(cs, "DEFAULT");
|
||||||
strcat(cs, ".");
|
strcat(cs, ".");
|
||||||
strcat(cs, ret);
|
strcat(cs, ret);
|
||||||
if ( ret )
|
free( ret );
|
||||||
free( ret );
|
|
||||||
}
|
}
|
||||||
} // If cstmp is NULL
|
} // If cstmp is NULL
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue