fix memory leaks + cast errors
fix memory leaks + cast errors

orieg/ganglia-svn.r2340-mod_php,orieg/ganglia-svn.r2340-mod_php,orieg/ganglia-svn.r2340-mod_php,orieg/ganglia-svn.r2340-mod_php,orieg/ganglia-svn.r2340-mod_php