Browse Source

remove a coverity issue

Julius Pfrommer 10 years ago
parent
commit
c58b919fc7
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/server/ua_server.c

+ 4 - 3
src/server/ua_server.c

@@ -125,16 +125,17 @@ static void UA_Server_cleanup(UA_Server *server, void *nothing) {
     /* remove channels that were not renewed or who have no connection attached */
     while(entry) {
         if(entry->channel.securityToken.createdAt +
-           (10000 * entry->channel.securityToken.revisedLifetime) > now ||
+           (10000 * entry->channel.securityToken.revisedLifetime) > now &&
            entry->channel.connection) {
             entry = LIST_NEXT(entry, pointers);
         } else {
             channel_list_entry *next = LIST_NEXT(entry, pointers);
             LIST_REMOVE(entry, pointers);
             UA_Connection *c = entry->channel.connection;
-            UA_Connection_detachSecureChannel(c);
-            if(c)
+			if (c) {
+                UA_Connection_detachSecureChannel(c);
                 c->close(c);
+            }
             UA_SecureChannel_detachSession(&entry->channel);
             UA_SecureChannel_deleteMembers(&entry->channel);
             UA_free(entry);