]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
"this" may be NULL if we don't have a new proxy socket
authorAlan T. DeKok <aland@freeradius.org>
Thu, 14 Mar 2013 02:01:33 +0000 (22:01 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 14 Mar 2013 02:01:33 +0000 (22:01 -0400)
src/main/process.c

index 05b0c268e5d3c475a0a4d20cdc3c8708153da7fa..d708973bb99564f35e5cca69ec3fd5ffce1b0ab9 100644 (file)
@@ -1728,17 +1728,19 @@ static int insert_into_proxy_hash(REQUEST *request)
        }
 
        /*
-        *      Tell the event loop that we have a new FD.  It locks
-        *      the socket, so we've got to unlock it here.
+        *      If we have a new socket, tell the event loop.  It
+        *      locks the socket, so we've got to unlock it here.
         */
-       PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
-       if (!event_new_fd(this)) {
-               listen_free(&this);
-               return 0;
+       if (this) {
+               PTHREAD_MUTEX_UNLOCK(&proxy_mutex);
+               if (!event_new_fd(this)) {
+                       listen_free(&this);
+                       return 0;
+               }
+               PTHREAD_MUTEX_LOCK(&proxy_mutex);
        }
-       PTHREAD_MUTEX_LOCK(&proxy_mutex);
 
-       request->proxy_listener = this;
+       request->proxy_listener = proxy_listener;
        if (!fr_packet_list_insert(proxy_list, &request->proxy)) {
                fr_packet_list_id_free(proxy_list, request->proxy);
                PTHREAD_MUTEX_UNLOCK(&proxy_mutex);