Hi,
I have copied and tweaked the module rlm_dbm to support Bernstein's
CDB as backend. Wasn't hard and seems to work, I've just "emulated"
dbm_open, dbm_fetch and dbm_close.
But I'm wondering whether there is a free() call missing. The manpage
of dbm_fetch states that the dptr is allocated using malloc and the
dbm (or gdbm or ndbm) will not free it but the programmer is
responsible to free it on its own.
To search for some data:
content = gdbm_fetch ( dbf, key )
Dbf is the pointer returned by gdbm_open. Key is the key
data.
If the dptr element of the return value is NULL, no data was
found. Otherwise the return value is a pointer to the found
data. The storage space for the dptr element is allocated
using malloc(3C). Gdbm does not automatically free this
data. It is the programmer's responsibility to free this
storage when it is no longer needed.
Now, I see the dbm_fetch (d = dbm_fetch(...), then a lot of userparse(), pairmove(),
pairfree(). But if I've learned correctly from lib/valuepair.c,
attribute names and values will be copied from the string supplied to
userparse().
And then, finally, I see no free(d.dptr). Is it actually missing or am
I off the track?
Thanks,
Wolfgang
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html