dtinfo: Fix coverity issues for resource leaks
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user