Fix dropped GC root in fl_vector_alloc (#48)

This commit is contained in:
Doug Currie 2017-08-09 21:59:04 +01:00 committed by Jeff Bezanson
parent 2afeb42f92
commit 19cecdac20
1 changed files with 4 additions and 6 deletions

View File

@ -284,16 +284,14 @@ static value_t fl_vector_alloc(value_t *args, u_int32_t nargs)
i = (fixnum_t)toulong(args[0], "vector.alloc");
if (i < 0)
lerror(ArgError, "vector.alloc: invalid size");
v = alloc_vector((unsigned)i, 0);
if (nargs == 2)
f = args[1];
else
f = FL_UNSPECIFIED;
v = alloc_vector((unsigned)i, f==FL_UNSPECIFIED);
if (f != FL_UNSPECIFIED) {
int k;
for(k=0; k < i; k++)
vector_elt(v,k) = f;
}
int k;
for(k=0; k < i; k++)
vector_elt(v,k) = f;
return v;
}