Re: Small memory bug in gimpact

"Jon Watte (ODE)" <[email protected]> Tue, 20 Nov 2007 17:15:40 -0800
Newsgroups gmane.comp.lib.ode
Message-ID <[email protected]>
That is the whole point. The only reason that code is there is to break 
into the debugger when malloc() returns NULL. Which it does either when 
you have corrupted the heap (most likely), or when you're trying to run 
a model larger than your system can handle (less likely).

Cheers,

          / h+


Chunky Kibbles wrote:
> 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 (-;
> _______________________________________________
> ODE mailing list
> [email protected]
> http://ode.org/mailman/listinfo/ode
>
>
>