- fixed three instances of unchecked mallocs reported by laqrix in
github issue #77. io.c, schlib.c, thread.c original commit: fe172bfdfbf2f606db611013e7689d6a2b117d5e
This commit is contained in:
parent
6f820db2d8
commit
f16869bb35
3
LOG
3
LOG
|
@ -253,3 +253,6 @@
|
|||
concurrently. Updated $yield and $thread-check in mats/thread.ms to
|
||||
be more tolerant of timing variability.
|
||||
c/types.h, mats/thread.ms, release_notes.stex
|
||||
- fixed three instances of unchecked mallocs reported by laqrix in
|
||||
github issue #77.
|
||||
io.c, schlib.c, thread.c
|
||||
|
|
2
c/io.c
2
c/io.c
|
@ -84,7 +84,7 @@ char *S_malloc_pathname(const char *inpath) {
|
|||
/* if no ~ or tilde dir can't be found, copy inpath */
|
||||
{
|
||||
size_t n = strlen(inpath) + 1;
|
||||
outpath = (char *)malloc(n);
|
||||
if ((outpath = (char *)malloc(n)) == NULL) S_error("expand_pathname", "malloc failed");
|
||||
memcpy(outpath, inpath, n);
|
||||
return outpath;
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ void S_call_help(tc, singlep) ptr tc; IBOOL singlep; {
|
|||
CP(tc) = AC1(tc);
|
||||
|
||||
jb = CREATEJMPBUF();
|
||||
if (jb == NULL)
|
||||
S_error_abort("unable to allocate memory for jump buffer");
|
||||
FRAME(tc, -1) = CCHAIN(tc) = Scons(Scons(jb, code), CCHAIN(tc));
|
||||
|
||||
switch (SETJMP(jb)) {
|
||||
|
|
|
@ -63,6 +63,8 @@ ptr S_create_thread_object() {
|
|||
ptr v = S_vector_in(space_new, 0, n);
|
||||
|
||||
tc = (ptr)malloc(size_tc);
|
||||
if (tc == (ptr)0)
|
||||
S_error("fork-thread", "unable to malloc thread data structure");
|
||||
memcpy((void *)tc, (void *)p_tc, size_tc);
|
||||
|
||||
for (i = 0; i < n; i += 1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user