dtwm: Resolve coverity warnings related to uninitialised variables and missing return...
authorPeter Howkins <flibble@users.sf.net>
Tue, 1 May 2018 19:45:55 +0000 (20:45 +0100)
committerPeter Howkins <flibble@users.sf.net>
Tue, 1 May 2018 19:45:55 +0000 (20:45 +0100)
13 files changed:
cde/programs/dtwm/Callback.c
cde/programs/dtwm/DataBaseLoad.c
cde/programs/dtwm/PopupMenu.c
cde/programs/dtwm/UI.c
cde/programs/dtwm/WmBackdrop.c
cde/programs/dtwm/WmCDecor.c
cde/programs/dtwm/WmCEvent.c
cde/programs/dtwm/WmFP.c
cde/programs/dtwm/WmFunction.c
cde/programs/dtwm/WmHelp.c
cde/programs/dtwm/WmIconBox.c
cde/programs/dtwm/WmWinConf.c
cde/programs/dtwm/WmXSMP.c

index 668d899e0016480695e4cb1e951ea73657b6ccbf..56d3a038e855efffe1a8929ffd3d255acf02a8cb 100644 (file)
@@ -973,7 +973,7 @@ SwitchRenameCB (Widget    w,
    SwitchData * switch_data;
 
    Boolean valid;
-   int     current_switch;
+   int     current_switch = 0;
    int     i;
         
    int ac;
index 009011007531dc91c8946f23491682020b024b62..8619c4691d6aa9209b4f7589c7410569121bab0b 100644 (file)
@@ -1219,7 +1219,7 @@ ProcessRecord (DtDtsDbField   * fields,
    int i, j;
    int entry;
 
-   int keyword_count;
+   int keyword_count = 0;
    char ** field_keywords;
 
 
@@ -2318,6 +2318,7 @@ AddControlActionList (ControlData * control_data)
             {
                /* DtDTS_DA_ACTION_LIST */
                case 0:
+                  free(act_list); /* Remove any previous loop run through */
                   act_list = (char *) strdup(attr_list[i]->value);
                break;
 
index 5c7c94e7fddb986bde3d727aa5c3deeca52ae930..8216f50b8445eb53440f5eae3934f7a64887c7d8 100644 (file)
@@ -137,7 +137,7 @@ DeleteWorkspaceCB (Widget    w,
 
 {
    long delete_workspace = (long) client_data;
-   SwitchData * switch_data;
+   SwitchData * switch_data = NULL;
    int i;
    
 
@@ -152,9 +152,12 @@ DeleteWorkspaceCB (Widget    w,
          break;
       }
    }
-   
-   _DtWsmDeleteWorkspace (panel.shell, 
-                          switch_data->atom_names[delete_workspace]);
+
+   if(switch_data)
+   {
+      _DtWsmDeleteWorkspace (panel.shell, 
+                             switch_data->atom_names[delete_workspace]);
+   }
 }
 
 
index 1209c451f260ed6c0313392cbc2b4cc867bb9fb3..a2e3d22bd7af5c90a7eb42d650e6e83f512e7a6d 100644 (file)
@@ -2004,7 +2004,7 @@ SwitchCreate (BoxData * box_data)
    int     switch_count = 1;
    Atom  * atom_names;
    Atom    current_workspace_atom;
-   int     current_workspace;
+   int     current_workspace = 0;
 
    Widget switch_button;
 
@@ -3186,7 +3186,7 @@ AddSubpanel (ControlData * control_data)
 
 {
    ElementValue * element_values;
-   SubpanelData * subpanel_data;
+   SubpanelData * subpanel_data = NULL;
    BoxData * box_data = (BoxData *)control_data->parent_data;
 
    DtWmHints vHints;
@@ -3259,7 +3259,9 @@ AddSubpanel (ControlData * control_data)
 
    box_data->subpanel_count++;
 
-   SubpanelCreate (control_data, subpanel_data);
+   if(subpanel_data) {
+      SubpanelCreate (control_data, subpanel_data);
+   }
 
 
    XtSetArg (al[0], XmNimageName, post_arrow_image);
index b48591c2d245ef011296f0b1eae4bd6bacd12feb..dd4a7262f3610910d417b969114618cbff51582e 100644 (file)
@@ -441,9 +441,12 @@ ProcessBackdropResources(
                pch = NULL;
            }
            free (pchImageName);        /* temporary string */
+           pchImageName = NULL;
            free (pchL);        /* temporary string */
        }
     }
+
+    free (pchImageName);
 }
 
 \f
index d97b2a60e6196b7f1384000923cc97ec5cae2665..58a1cb1ed2a548314a2381f5c7b6ae7671282e9e 100644 (file)
@@ -566,9 +566,9 @@ void GenerateFrameDisplayLists (ClientData *pcd)
     int insideBevel, inset, diffBevel;
     unsigned int nTitleBevel, sTitleBevel, eTitleBevel, wTitleBevel;
     unsigned int meTitleBevel, inWidth;
-    int x, y, xAdj, yAdj;
+    int x, y, xAdj = 0, yAdj = 0;
     unsigned int width, height;
-    RList *prlTop, *prlBot;
+    RList *prlTop = NULL, *prlBot = NULL;
 
     int jX, jY;
     unsigned int jW, jH;
index d55b883a85c6db899901a56d98f68c47bec45385..1483ff7d582f176bb6f4df4a2ae71b090f06519f 100644 (file)
@@ -2569,7 +2569,7 @@ void HandleCColormapNotify (ClientData *pCD, XColormapEvent *colorEvent)
 
 void HandleClientMessage (ClientData *pCD, XClientMessageEvent *clientEvent)
 {
-    unsigned int newState;
+    unsigned int newState = WITHDRAWN_STATE;
 
     /*
      * Process the client message event based on the message_type.
index 5fa0d3e47f2283dc69b83b86e44b095d38dde93a..48a8b6293e9ef98a929d6fb3d406079690ffa7c0 100644 (file)
@@ -610,6 +610,9 @@ PushRecallGetData (char * client_name)
    for (i = 0; i < panel.push_recall_count; i++)
       if (strcmp (client_name, push_recall_list[i].pchResName) == 0)
          return (i);
+
+   /* Should never get here */
+   return 0;
 }
    
  
index 1cf1cb942b4e0a56e37b333916735406e440fd58..52cfdad174a4709e6dad3568f7f823fa5a5a7a29 100644 (file)
@@ -2285,7 +2285,7 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
 
            if (!bWaiting)
            {
-               long clientTimeout;
+               long clientTimeout = 0;
                Arg al[5];
                int ac;
                WmPanelistObject  pPanelist;
index 1574d786c06ede06d5e4d0f77ba3283115eca5db..c66a2160ee616ad17af52dbedb9b577f8be69cef 100644 (file)
@@ -2044,6 +2044,8 @@ RestoreHelpDialogs(
        XrmDestroyDatabase(db);
     }
 #endif /* NO_DT */
+
+    return True;
 } /* END OF FUNCTION  RestoreHelpDialogs */
 
 /*************************************<->*************************************
index dfcea3ff7c922fc20fb38da441e02c89accf911d..166f0ddd639e85fd0f8ba0d0d7aef3b3f4a4460c 100644 (file)
@@ -2887,7 +2887,7 @@ void PackIconBox (IconBoxData *pIBD, Boolean packVert, Boolean packHorz, int pas
     int ix1, ix2;
     int count;
     int newX, newY;
-    ClientData *pCD_tmp, *pMyCD;
+    ClientData *pCD_tmp = NULL, *pMyCD;
     int hasActiveText = 1;
     Arg args[4];
     Dimension majorDimension, minorDimension;
index a67da0c165e88e6517555012c2931b0ee8dce23d..47874a4fff2ea3db1a928bf914b89689b65bce9e 100644 (file)
@@ -688,7 +688,7 @@ Boolean HandleResizeKeyPress (ClientData *pcd, XEvent *pev)
 {
     KeySym keysym;
     Boolean control;
-    int warpX, warpY, currentX, currentY, newX, newY;
+    int warpX, warpY, currentX = 0, currentY = 0, newX, newY;
     int junk, keyMult;
     Window junk_win;
     XEvent KeyEvent;
index 04c68b59d33c29e08a7c11c39b64760e656707f5..5e6fc4d4a22c947be063acaaf27be33a003b40e1 100644 (file)
@@ -485,7 +485,7 @@ getClientWorkspaces(ClientData *pCD)
     /* Easy but slow way to do this would be to use XGetAtomName(). */
     /* To avoid XServer round trips (and to weed out invalid WS names) */
     /* we look through workspaces attached to this screen for ID matches. */
-    char *cwsP, *tmpP, *wsNameP;
+    char *cwsP = NULL, *tmpP, *wsNameP;
     int pLen = 0;
     int i;