Add an error code.
[radsecproxy.git] / lib / radsec.c
index 1ffc244..e176b6d 100644 (file)
@@ -64,7 +64,7 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict)
   char *fn = NULL;
 
   if (dict == NULL)
-    if (ctx->config != NULL)
+    if (ctx->config != NULL && ctx->config->dictionary)
       dict = ctx->config->dictionary;
 
   if (dict == NULL)
@@ -83,7 +83,8 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict)
 
   if (dict_init (dirname (dir), basename (fn)) < 0)
     {
-      r = rs_err_ctx_push_fl (ctx, RSE_FR, __FILE__, __LINE__, "dict_init");
+      r = rs_err_ctx_push_fl (ctx, RSE_FR, __FILE__, __LINE__,
+                             "failing dict_init(\"%s\")", dict);
       goto out;
     }
 
@@ -95,11 +96,11 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict)
   return r;
 }
 
-struct rs_error *         /* FIXME: Return int as all the others?  */
-rs_resolv (struct evutil_addrinfo **addr,
-          rs_conn_type_t type,
-          const char *hostname,
-          const char *service)
+struct rs_error *
+rs_resolve (struct evutil_addrinfo **addr,
+            rs_conn_type_t type,
+            const char *hostname,
+            const char *service)
 {
   int err;
   struct evutil_addrinfo hints, *res = NULL;
@@ -149,12 +150,16 @@ rs_context_destroy (struct rs_context *ctx)
          for (p = r->peers; p; )
            {
              struct rs_peer *tmp = p;
-             if (p->addr)
-               evutil_freeaddrinfo (p->addr);
+             if (p->addr_cache)
+                {
+                  evutil_freeaddrinfo (p->addr_cache);
+                  p->addr_cache = NULL;
+                }
              p = p->next;
              rs_free (ctx, tmp);
            }
          free (r->name);
+          rs_free (ctx, r->transport_cred);
          r = r->next;
          rs_free (ctx, tmp);
        }