assert in malloc.c:383

Sergei Organov osv at topconrd.ru
Fri Jan 14 13:21:55 UTC 2005


Karel Gardas <kgardas at objectsecurity.com> writes:
> Hello,
> 
> while trying to start my application, it asserts deeply in RTEMS code in
> cpukit/libcsupport/src/malloc.c:383 -- I'm talking here about 4-6-branch.
> 
> The problematic code is a part of free function and it looks:
> 
>      380   status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr );
>      381   if ( status != RTEMS_SUCCESSFUL ) {
>      382     errno = EINVAL;
>      383     assert( 0 );
>      384   }
> 
> my question is: how to prevent it?

By means of fixing your program, I'm afraid.

> Is assert on this place really needed, especially when I consider that
> you set errno on this place. What does this assert mean?

It means that this should never happen in a correctly behaving program.
Most probably you either have broken heap or call free() on a pointer
that has not been received from malloc()/realloc().

-- 
Sergei.




More information about the users mailing list