freeradius-client "radius_timeout" and freeradius-client vs freeradius-server

Alex Massover alex at
Wed Mar 24 09:26:22 CET 2010

> > right way to go the 1.1.6 release downloadable on the homepage -
> > unfortunately this release does not have the patches from Alex
> Massover
> > regarding seqfile and thread safety.
>   The CVS source has the fixes.  We'll apply a few more, and release a
> 1.1.7 soon.
>   Alan DeKok.

[Alex] Hi, I'm aware of one more memory leak in thread per request scenario.

It's in lib/ip_utils.c, if new thread created for every radius request, tmphostbuf is not freed.

The easiest fix that I'm using currently is:

-static __thread       char    *tmphostbuf=NULL;
+static __thread char tmphostbuf[HOSTBUF_SIZE];

and getting rid of realloc(). This way tmphostbuf is automatically freed, but if gethostby*_r() returns ERANGE we have a trouble. 

For me HOSTBUF_SIZE=2048 always works :)
As far as I understood 8192 "ought to be enough for anybody" :) because of internal implementation of gethostby*_r.
The question is if such fix is good enough to be applied, if yes I'll provide a patch.

If no, other option is adopting utils from misc.c from freeradius server code instead of ip_utils.c, but it will require rewriting some interfaces.
This probably is the cleanest option.

This mail was sent via Mail-SeCure System.

More information about the Freeradius-Devel mailing list