Browse Source

ERR: Added error check for malloc of process control structure.

Brad King 22 years ago
parent
commit
751509cf10
1 changed files with 5 additions and 0 deletions
  1. 5 0
      Source/kwsys/ProcessWin32.c

+ 5 - 0
Source/kwsys/ProcessWin32.c

@@ -210,6 +210,11 @@ kwsysProcess* kwsysProcess_New()
   
   /* Allocate a process control structure.  */
   cp = (kwsysProcess*)malloc(sizeof(kwsysProcess));
+  if(!cp)
+    {
+    /* Could not allocate memory for the control structure.  */
+    return 0;
+    }
   ZeroMemory(cp, sizeof(*cp));
   
   /* Set initial status.  */