Small memory bug in gimpact

Chunky Kibbles <[email protected]> Tue, 20 Nov 2007 02:05:42 -0500
Newsgroups gmane.comp.lib.ode
Organization Kibbles'n'Bits
Message-ID <[email protected]>
Heya, I'm fairly certain this qualifies as a bug in gimpact.

In gim_memory.cpp [in ODE 0.9], lines118-129:
void * gim_alloc(size_t size)
{
	void * ptr = 0;
	ptr = malloc(size);
	/*if (g_allocfn) ptr = g_allocfn(size); else ptr = * malloc(size);//_mm_malloc(size,0);*/
	if(ptr==0)
	{
		float * fp = 0;
		*fp = 0.0f;
	}
	return ptr;
}

That *fp=0.0f is always assigning a value to the memory pointed to by
a a null pointer, which throws an exception here.

Thanks,
Gary (-;