From 062f4d052949b2cd7d7a912c8c4980913a8d6f5b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 15 May 2023 11:15:28 +0000 Subject: ckalloc -> attemptckalloc (since return-value is checked). Fix bug in unix/dltest/pkgooa.c, where last NULL-argument was missing --- compat/opendir.c | 2 +- unix/dltest/pkgooa.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/opendir.c b/compat/opendir.c index 07ef572..64aedaa 100644 --- a/compat/opendir.c +++ b/compat/opendir.c @@ -28,7 +28,7 @@ opendir( if ((fd = open(myname, 0, 0)) == -1) { return NULL; } - dirp = (DIR *) ckalloc(sizeof(DIR)); + dirp = (DIR *) attemptckalloc(sizeof(DIR)); if (dirp == NULL) { /* unreachable? */ close(fd); diff --git a/unix/dltest/pkgooa.c b/unix/dltest/pkgooa.c index 06ff3ac..d731e48 100644 --- a/unix/dltest/pkgooa.c +++ b/unix/dltest/pkgooa.c @@ -110,18 +110,18 @@ Pkgooa_Init( } if (tclStubsPtr == NULL) { Tcl_AppendResult(interp, "Tcl stubs are not initialized, " - "did you compile using -DUSE_TCL_STUBS? "); + "did you compile using -DUSE_TCL_STUBS? ", NULL); return TCL_ERROR; } if (Tcl_OOInitStubs(interp) == NULL) { return TCL_ERROR; } if (tclOOStubsPtr == NULL) { - Tcl_AppendResult(interp, "TclOO stubs are not initialized"); + Tcl_AppendResult(interp, "TclOO stubs are not initialized", NULL); return TCL_ERROR; } if (tclOOIntStubsPtr == NULL) { - Tcl_AppendResult(interp, "TclOO internal stubs are not initialized"); + Tcl_AppendResult(interp, "TclOO internal stubs are not initialized", NULL); return TCL_ERROR; } -- cgit v0.12 From db43c8cbed9e1d40d644e2ecb9112606d4a528bd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 15 May 2023 11:43:15 +0000 Subject: One more ckalloc -> attemptckalloc (in compat/waitpid.c), since we can handle the error. --- compat/waitpid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compat/waitpid.c b/compat/waitpid.c index 6f43934..e41361b 100644 --- a/compat/waitpid.c +++ b/compat/waitpid.c @@ -156,7 +156,11 @@ waitpid( goto waitAgain; } } - waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo)); + waitPtr = (WaitInfo *) attemptckalloc(sizeof(WaitInfo)); + if (!waitPtr) { + errno = ENOMEM; + return -1; + } waitPtr->pid = result; waitPtr->status = status; waitPtr->nextPtr = deadList; -- cgit v0.12