diff options
Diffstat (limited to 'compat')
-rw-r--r-- | compat/opendir.c | 3 | ||||
-rw-r--r-- | compat/waitpid.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/compat/opendir.c b/compat/opendir.c index 13eb974..23803ff 100644 --- a/compat/opendir.c +++ b/compat/opendir.c @@ -28,9 +28,8 @@ opendir( if ((fd = open(myname, 0, 0)) == -1) { return NULL; } - dirp = (DIR *) Tcl_Alloc(sizeof(DIR)); + dirp = (DIR *) Tcl_AttemptAlloc(sizeof(DIR)); if (dirp == NULL) { - /* unreachable? */ close(fd); return NULL; } diff --git a/compat/waitpid.c b/compat/waitpid.c index cf025b0..cd04d8b 100644 --- a/compat/waitpid.c +++ b/compat/waitpid.c @@ -156,7 +156,11 @@ waitpid( goto waitAgain; } } - waitPtr = (WaitInfo *) Tcl_Alloc(sizeof(WaitInfo)); + waitPtr = (WaitInfo *) Tcl_AttemptAlloc(sizeof(WaitInfo)); + if (!waitPtr) { + errno = ENOMEM; + return -1; + } waitPtr->pid = result; waitPtr->status = status; waitPtr->nextPtr = deadList; |