Christopher R. Hertel
crh at NTS.Umn.EDU
Wed May 6 18:08:14 GMT 1998
> Hi Chris,
> You use a pointer to "free" in the new mangled cache stuff. You can't
> do that. free() could easily be a macro on some systems.
Ahh. Good point. Quick fix similar to the one you outlined below.
> anyway, a quick fix would be to use a ubiqx_free function that calls
> free. Preferably inside a module that includes the standard Samba
> includes so it can benefit from -DMEM_MAN if defined.
I would add it to mangle.c, just below the comparison function.
> Maybe a better fix is to not pass a free function at all to ubiqx init
> calls. maybe ubiqx should really clean up its own memory via some sort
> of ubi_Destroy() call ?
No good. The tree and list modules don't know anything about how the
memory is being managed. It may be a free list, or a chunk of a large
pre-allocated buffer, or something else. I originally wrote this stuff to
work on an Amiga and assumed that people might want to use the low-level
OS memory management calls in the exec.library.
The cache is built on top of the trees, so I put a pointer to a free
function into the cache header. I let the calling code allocate the
needed memory, but the cache may need to free an entry at any time, thus
So, the *right* way to do it is as you suggest: I'll check in a new
mangle.c with a cache_free_entry() function *of the correct type* as soon
as it's tested.
Christopher R. Hertel -)----- University of Minnesota
crh at nts.umn.edu Networking and Telecommunications Services
More information about the samba-technical