R-alpha: R 0.50.a1 S_alloc BUG, priority = URGENT

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Mon, 28 Jul 1997 15:23:46 +0200

The current version of S_alloc in src/main/memory.c is

char *S_alloc(long nelem, int eltsize)
	unsigned int i, size;
	char *p = R_alloc(nelem, eltsize);
	for(i=0 ; i<size; i++)
		p[i] = 0;
	return p;

which segfaults because `size' is not initialized.  I am not what the
right fix is, adding

	size = nelem * eltsize;

before the loop seems to work.

As an aside ... I think the seed* functions in S are called


and not seeds_in and seeds_out as currently in src/main/random.c.

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch