1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtwm: Resolve coverity warnings

This commit is contained in:
Peter Howkins 2018-04-02 18:08:40 +01:00
parent 4b9bcae29f
commit 8362f92ceb
14 changed files with 39 additions and 46 deletions

View file

@ -290,6 +290,7 @@ StringToAction (char * parse_source,
{
_DtSimpleError (panel.app_name, DtError, NULL,
"Invalid Action -- %s", parse_source);
free (head_ptr);
return (False);
}

View file

@ -179,7 +179,7 @@ RenameWorkspaceCB (Widget w,
{
long rename_ws = (long) client_data;
SwitchData * switch_data;
SwitchData * switch_data = NULL;
int i;
@ -195,7 +195,9 @@ RenameWorkspaceCB (Widget w,
}
}
SwitchRenameLabel (switch_data->buttons[rename_ws], panel.box_data[i]);
if(switch_data) {
SwitchRenameLabel (switch_data->buttons[rename_ws], panel.box_data[i]);
}
}

View file

@ -832,5 +832,7 @@ SessionDeleteAll(void)
strcpy(srcname + srclen, entry->d_name);
remove (srcname);
}
closedir(dir);
}

View file

@ -440,14 +440,8 @@ ProcessBackdropResources(
}
pch = NULL;
}
if (pchImageName)
{
free (pchImageName); /* temporary string */
}
if (pchL)
{
free (pchL); /* temporary string */
}
free (pchImageName); /* temporary string */
free (pchL); /* temporary string */
}
}
}

View file

@ -1239,7 +1239,7 @@ void CheckButtonPressBuiltin (XButtonEvent *buttonEvent, Context context, Contex
* the resources or the user has specifically requested
* that "move" not be one of them.
*/
if (pCD->clientFunctions & MWM_FUNC_MOVE)
if (pCD && (pCD->clientFunctions & MWM_FUNC_MOVE))
{
wmGD.preMove = True;
wmGD.preMoveX = buttonEvent->x_root;

View file

@ -292,7 +292,7 @@ EmbeddedClientRegister (ControlData * control_data,
if (embedded_client_list[i].wControl == control_data->icon)
{
Position remove_y;
Dimension adjust_y;
Dimension adjust_y = 0;
/* This block will reparent the client window, move it */
@ -312,7 +312,9 @@ EmbeddedClientRegister (ControlData * control_data,
/* deleted control height plus 5 pixels of form offset */
adjust_y = XtHeight (control_data->icon) + 5;
if(control_data->icon) {
adjust_y = XtHeight (control_data->icon) + 5;
}
panel.embedded_client_count--;

View file

@ -991,7 +991,9 @@ void WmDtHelpOnVersion (
Widget helpButton = NULL;
Widget backButton = NULL;
Widget closeButton = NULL;
#ifdef NO_MESSAGE_CATALOG
XmString label = NULL;
#endif
if((versionWidget != NULL) &&
(XtIsManaged(versionWidget)))
@ -1035,7 +1037,9 @@ void WmDtHelpOnVersion (
#endif
XtSetValues(closeButton, setArgs2, n2);
#ifdef NO_MESSAGE_CATALOG
if(label)XmStringFree(label);
#endif
printButton = DtHelpQuickDialogGetChild( versionWidget,
DtHELP_QUICK_PRINT_BUTTON );
@ -1664,7 +1668,7 @@ RestoreHelpDialogs(
int wsCnt;
int cCount;
int cachedCount=0;
char dialogName[10];
char dialogName[18];
ClientData *pCD = NULL;
char *tTitle = NULL;
@ -2787,7 +2791,9 @@ wmDtErrorDialog(
if (pSD->dtHelp.errorDialog == NULL)
{
#ifdef NO_MESSAGE_CATALOG
XmString tmpXmString = (XmString)NULL;
#endif
ac = 0;
XtSetArg (al[ac], XmNmessageString, xmsMessage); ac++;
@ -2815,8 +2821,10 @@ wmDtErrorDialog(
pSD->dtHelp.errorDialog =
XmCreateErrorDialog (wParent, "Error Dialog", al, ac);
#ifdef NO_MESSAGE_CATALOG
if (tmpXmString)
XmStringFree(tmpXmString);
#endif
wTemp = XmMessageBoxGetChild (pSD->dtHelp.errorDialog,
XmDIALOG_HELP_BUTTON);

View file

@ -1081,7 +1081,7 @@ char *BitmapPathName (string)
strncat (fileName, &wmGD.bitmapDirectory[1],
MAXWMPATH - strlen (fileName));
} else {
strcpy (fileName, wmGD.bitmapDirectory);
snprintf(fileName, sizeof(fileName), "%s", wmGD.bitmapDirectory);
}
strncat (fileName, "/", MAXWMPATH - strlen (fileName));
strncat (fileName, string, MAXWMPATH - strlen (fileName));

View file

@ -4050,7 +4050,7 @@ void PostMenu (MenuSpec *menuSpec, ClientData *pCD, int x, int y, unsigned int b
* Compute position if necessary (system menu).
*/
if (!(flags & POST_AT_XY))
if (pCD && !(flags & POST_AT_XY))
/* compute the position */
{
GetSystemMenuPosition (pCD, &x, &y, menuSpec->height, newContext);

View file

@ -108,6 +108,8 @@ WmHeadInfo_t *GetHeadInfo(const ClientData *pcd) {
return WmHI;
}
free(WmHI);
/* No valid screen */
return NULL;
}

View file

@ -2512,8 +2512,11 @@ FILE *FopenConfigFile (void)
* Run the file through the C-preprocessor
*/
PreprocessConfigFile ();
if (pConfigStackTop->cppName)
if (pConfigStackTop && pConfigStackTop->cppName)
{
if(fileP) {
fclose(fileP);
}
/* open the result */
fileP = fopen (pConfigStackTop->cppName, "r");
}

View file

@ -398,35 +398,17 @@ void InitBuiltinSystemMenu(void)
else
{
/* put it together */
strcpy(dsm, defaultSystemMenuName);
strcat(dsm, "\n{\n");
strcat(dsm, ResString);
strcat(dsm, "\n");
strcat(dsm, MovString);
strcat(dsm, "\n");
strcat(dsm, SizString);
strcat(dsm, "\n");
strcat(dsm, MinString);
strcat(dsm, "\n");
strcat(dsm, MaxString);
strcat(dsm, "\n");
strcat(dsm, LowString);
strcat(dsm, "\n");
strcat(dsm, " no-label f.separator\n");
snprintf(dsm, sizeof(dsm), "%s\n{\n%s)\n%s\n%s\n%s\n%s\n%s\n no-label f.separator\n",
defaultSystemMenuName, ResString, MovString,
SizString, MinString, MaxString, LowString);
#ifdef WSM
if (DtwmBehavior)
{
strcat(dsm, OcpString);
strcat(dsm, "\n");
strcat(dsm, OcaString);
strcat(dsm, "\n");
strcat(dsm, RemString);
strcat(dsm, "\n");
strcat(dsm, " no-label f.separator\n");
snprintf(dsm, sizeof(dsm), "%s%s\n%s\n%s\n no-label f.separator\n",
dsm, OcpString, OcaString, RemString);
}
#endif /* WSM */
strcat(dsm, CloString);
strcat(dsm, "\n}");
snprintf(dsm, sizeof(dsm), "%s%s\n}", dsm, CloString);
if ((builtinSystemMenu =
(char *)XtMalloc ((unsigned int) (strlen(dsm) + 1))) == NULL)

View file

@ -4202,7 +4202,7 @@ StartMarqueeSelect(WmScreenData *pSD, XEvent *pev)
/*
* Set up static variables for succeeding events
*/
if ((pev->type == ButtonPress) || (pev->type == ButtonRelease))
if (pev && (pev->type == ButtonPress) || (pev->type == ButtonRelease))
{
pointerX = pev->xbutton.x_root;
pointerY = pev->xbutton.y_root;

View file

@ -3857,10 +3857,7 @@ SaveWorkspaceResources(
XtFree(data);
}
if (buffer)
{
XtFree(buffer);
}
XtFree(buffer);
} /* END OF FUNCTION SaveWorkspaceResources */