Patch/Bugfix for BOOTP in rtems-ss-20020205
Thomas Doerfler
Thomas.Doerfler at imd-systems.de
Tue Mar 19 22:11:19 UTC 2002
Hi Till,
sigh, you are right, free is overloaded...
I have checked bootpc_init once more, the strdup function is
called several times for various strings. When this function
gets called multiple times, the corresponding allocated space
gets lost, so there is really a memory leak!!
Either we leave it the way it is, with a warning comment (my
current preferred solution) or we look for a general solution.
The module uses strdup to malloc memory, but the free function
is actually hidden. Hm. Is this really a good solution? Maybe
the strdup should be overloaded aswell to use networking
memory? This would at least be consistent.
I am not really happy to use "realloc(x,0)", because I am not
quite sure whether realloc doesn't leave some sort of "zero
sized fragment spots" on the heap.
Where exactly is "free" and "malloc" hidden? Is it possible to
make them available with a different name (like "__real_free"
or so)?
good night,
Thomas.
> Thomas Doerfler wrote:
>
> > Hi Till,
> >
> > I got your ideas. I have finalized the patch
> > (hopefully), find it attached to this mail.
> >
> > Joel, I also send this patch the the GNATS
> > system...
>
> Thomas
>
> Hold on - unfortunately, the patch doesn't work
> for me. The RTEMS/bsdnet headers seem to redefine
> malloc() and free() to rtems_bsdnet_malloc() and
> rtems_bsdnet_free(), respectively, which is probably
> not what we want to call (since the memory was
> allocated by strdup() using _real_ malloc().
>
> Hence, I'd suggest to replace the call to free() in your
> patch by a realloc() passing a size argument of zero.
> This should be equivalent to a free().
>
> Could you compile your version of the patch
> without the compiler complaining about missing args???
>
> Regards,
>
> -- Till
>
--------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler Herbststrasse 8
D-82178 Puchheim Germany
email: Thomas.Doerfler at imd-systems.de
PGP public key available at: http://www.imd-
systems.de/pgp_key.htm
More information about the users
mailing list