assert in malloc.c:383

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Fri Jan 14 14:02:34 UTC 2005


Karel Gardas wrote:
> 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? Is assert on this place really needed,
> especially when I consider that you set errno on this place. What does
> this assert mean?

This means you are freeing memory which was not allocated from
the heap.  The address given to free MUST match that given to
you by malloc.  So this could be a double free or a free of a bogus
address.

> Thanks,
> Karel
> --
> Karel Gardas                  kgardas at objectsecurity.com
> ObjectSecurity Ltd.           http://www.objectsecurity.com
> 
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the users mailing list