mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
dtinfo: Fix coverity issues for resource leaks
This commit is contained in:
parent
9ef3b9ec68
commit
2b15c4057e
11 changed files with 47 additions and 13 deletions
|
@ -172,8 +172,10 @@ __bt_sync(dbp, flags)
|
|||
if (ISSET(t, B_DELCRSR)) {
|
||||
if ((p = (void*)malloc(t->bt_psize)) == NULL)
|
||||
return (RET_ERROR);
|
||||
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
|
||||
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) {
|
||||
free(p);
|
||||
return (RET_ERROR);
|
||||
}
|
||||
memmove(p, h, t->bt_psize);
|
||||
if ((status =
|
||||
__bt_dleaf(t, h, t->bt_bcursor.index)) == RET_ERROR)
|
||||
|
@ -185,8 +187,10 @@ __bt_sync(dbp, flags)
|
|||
CLR(t, B_MODIFIED);
|
||||
|
||||
ecrsr: if (ISSET(t, B_DELCRSR)) {
|
||||
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
|
||||
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) {
|
||||
free(p);
|
||||
return (RET_ERROR);
|
||||
}
|
||||
memmove(h, p, t->bt_psize);
|
||||
free(p);
|
||||
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
|
||||
|
|
|
@ -191,8 +191,10 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le
|
|||
|
||||
while (*desc != '\0' && *desc != '\t') desc++;
|
||||
|
||||
if (*desc != '\t')
|
||||
if (*desc != '\t') {
|
||||
free(u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
desc++;
|
||||
|
||||
|
|
|
@ -413,15 +413,17 @@ Boolean page::_alloc_slot( int slot_num, int size, char*& str_ptr )
|
|||
|
||||
int new_blank_len = slot_info -> string_leng() ;
|
||||
|
||||
if ( new_blank_len < size )
|
||||
if ( new_blank_len < size ) {
|
||||
delete slot_info;
|
||||
return false;
|
||||
}
|
||||
|
||||
slot_info -> set_string_ofst( end_ptr );
|
||||
slot_info -> set_string_leng( size );
|
||||
slot_info -> set_mode(spointer_t::DELETED, false);
|
||||
slot_info -> set_forward_ptr(0);
|
||||
|
||||
delete slot_info;
|
||||
delete slot_info;
|
||||
|
||||
if ( slot_num == count() ) {
|
||||
|
||||
|
|
|
@ -698,8 +698,10 @@ int page_storage::deleteString(mmdb_pos_t loc, Boolean flush_opt)
|
|||
|
||||
spointer_t *x = y -> get_spointer(slot_num);
|
||||
|
||||
if ( x -> get_mode(spointer_t::DELETED) == true )
|
||||
if ( x -> get_mode(spointer_t::DELETED) == true ) {
|
||||
delete x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
loc = x -> forward_ptr();
|
||||
//debug(cerr, loc);
|
||||
|
|
|
@ -38,6 +38,7 @@ string::string(char* str, int size)
|
|||
|
||||
string::~string()
|
||||
{
|
||||
delete sbuf;
|
||||
}
|
||||
|
||||
char* string::c_str()
|
||||
|
|
|
@ -1967,6 +1967,9 @@ LibraryAgent::transferCB(Widget w, XtPointer client_data, XtPointer call_data)
|
|||
file = strdup(netfile);
|
||||
|
||||
if (file == NULL || *file == '\0') {
|
||||
if(file) {
|
||||
tt_free(file);
|
||||
}
|
||||
XtFree(netfile);
|
||||
XmTransferDone(cs->transfer_id, XmTRANSFER_DONE_FAIL);
|
||||
return;
|
||||
|
|
|
@ -202,8 +202,10 @@ void
|
|||
MessageAgent::displayMessage (char *message_text)
|
||||
{
|
||||
char *message_string = strdup(message_text);
|
||||
if(f_dialog == NULL)
|
||||
if(f_dialog == NULL) {
|
||||
free(message_string);
|
||||
return;
|
||||
}
|
||||
|
||||
XmStringLocalized mtfstring;
|
||||
|
||||
|
@ -245,8 +247,10 @@ MessageAgent::displayError (char *message_text, Widget parent)
|
|||
char *message_string = strdup(message_text);
|
||||
if (f_dialog == NULL)
|
||||
create_ui(parent);
|
||||
if (g_active)
|
||||
if (g_active) {
|
||||
free(message_string);
|
||||
return;
|
||||
}
|
||||
g_active = TRUE;
|
||||
|
||||
// Set the window title
|
||||
|
@ -282,8 +286,10 @@ MessageAgent::displayWarning (char *message_text, Widget parent)
|
|||
char *message_string = strdup(message_text);
|
||||
if (f_dialog == NULL)
|
||||
create_ui(parent);
|
||||
if (g_active)
|
||||
if (g_active) {
|
||||
free(message_string);
|
||||
return;
|
||||
}
|
||||
g_active = TRUE;
|
||||
|
||||
// Set the window title
|
||||
|
@ -319,8 +325,10 @@ MessageAgent::displayInformation (char *message_text, Widget parent)
|
|||
|
||||
if (f_dialog == NULL)
|
||||
create_ui(parent);
|
||||
if (g_active)
|
||||
if (g_active) {
|
||||
free(message_string);
|
||||
return;
|
||||
}
|
||||
g_active = TRUE;
|
||||
|
||||
// Set the window title
|
||||
|
@ -433,8 +441,10 @@ MessageAgent::displayQuestion (char *message_text, Widget parent)
|
|||
|
||||
if (f_dialog == NULL)
|
||||
create_ui(parent);
|
||||
if (g_active)
|
||||
if (g_active) {
|
||||
free(message_string);
|
||||
return (FALSE);
|
||||
}
|
||||
g_active = TRUE;
|
||||
|
||||
// Set the window title
|
||||
|
@ -485,8 +495,10 @@ MessageAgent::displayQuit (char *message_text, Widget parent)
|
|||
|
||||
if (f_dialog == NULL)
|
||||
create_ui(parent);
|
||||
if (g_active)
|
||||
if (g_active) {
|
||||
free(message_string);
|
||||
return;
|
||||
}
|
||||
g_active = TRUE;
|
||||
|
||||
// Set the window title
|
||||
|
|
|
@ -818,10 +818,11 @@ a human readable character string.
|
|||
static void
|
||||
OutputAnAtomName(Widget w, Atom target)
|
||||
{
|
||||
char *AtomName = (char *)malloc(sizeof(char *) * 34);
|
||||
char *AtomName = NULL;
|
||||
|
||||
AtomName = XGetAtomName(XtDisplay(w), target);
|
||||
printf("\t%s\n", AtomName);
|
||||
XFree(AtomName);
|
||||
}
|
||||
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
|
@ -934,12 +935,14 @@ OutlineListView::printConvertCallback(WCallback *wcb)
|
|||
// write out the locator
|
||||
if (fputs(((TOC_Element *)te)->toc()->locator(), fp) == EOF) {
|
||||
fprintf(stderr, "Cannot write file %s in current directory.\n", filepath);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
// write out eol
|
||||
if (fputs("\n", fp) == EOF) {
|
||||
fprintf(stderr, "Cannot write file %s in current directory.\n", filepath);
|
||||
fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -398,6 +398,7 @@ pattern_done:
|
|||
printf("pattern = %s.\n", pattern);
|
||||
#endif
|
||||
xlfd = strdup(pattern);
|
||||
free(dupfallback);
|
||||
return(xlfd);
|
||||
}
|
||||
|
||||
|
@ -456,6 +457,8 @@ pattern_done:
|
|||
#ifdef FONT_DEBUG
|
||||
printf("xlfd = %s.\n", xlfd);
|
||||
#endif
|
||||
|
||||
free(dupfallback);
|
||||
return(xlfd);
|
||||
|
||||
}
|
||||
|
|
|
@ -149,6 +149,7 @@ SearchPath::get_real_path( const char *file_name )
|
|||
fclose( fp );
|
||||
return ( full_path_name );
|
||||
}
|
||||
fclose( fp );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -533,6 +533,7 @@ void StyleTask::write_record( void )
|
|||
else {
|
||||
Token::signalError(Token::User, Token::Continuable, 0, 0,
|
||||
"Duplicate stylesheet id `%s'", localstr);
|
||||
delete bogus;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue