Skip to content

Commit

Permalink
Fix segfault when ALLOCAP failed to allocate.
Browse files Browse the repository at this point in the history
  • Loading branch information
nominolo committed Jan 17, 2012
1 parent 182096e commit b1aca84
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rts/InterpThreaded.c
Expand Up @@ -1264,12 +1264,14 @@ int engine(Capability *cap)

LC_ASSERT(nargs >= 1);

Closure *cl = allocClosure(wordsof(ClosureHeader) + nargs + 1);
u1 *args = (u1 *)pc;
pc += 1 + BC_ROUND(nargs + 1);

Closure *cl = allocClosure_(wordsof(ClosureHeader) + nargs + 1,
T, pc, base);
InfoTable *info = getApInfoTable(nargs, pointer_mask);
setInfo(cl, info);

u1 *args = (u1 *)pc;
pc += 1 + BC_ROUND(nargs + 1);
for (i = 0; i < nargs + 1; i++, args++)
cl->payload[i] = base[*args];

Expand Down

0 comments on commit b1aca84

Please sign in to comment.