[ 
https://issues.apache.org/jira/browse/DISPATCH-2207?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17385510#comment-17385510
 ] 

ASF GitHub Bot commented on DISPATCH-2207:
------------------------------------------

ganeshmurthy commented on a change in pull request #1310:
URL: https://github.com/apache/qpid-dispatch/pull/1310#discussion_r674804685



##########
File path: src/server.c
##########
@@ -1352,9 +1352,12 @@ static void try_open_cb(void *context)
         // else deleted or failed - on failed wait until after connection is 
freed
         // and state is set to CXTR_STATE_CONNECTING (timer is rescheduled 
then)
         try_open_lh(ct, ctx);
+        ctx = 0;  // owned by ct
     }
 
     sys_mutex_unlock(ct->lock);
+
+    free_qd_connection_t(ctx);  // noop if ctx == 0

Review comment:
       My comment is not about this fix but about the readability of this code. 
A previous commit moved the creation of qd_connection_t from inside of 
try_open_lh() to try_open_cb() and this is to avoid the lock issues caused by 
the connector-entity cache lock inversion. From my point of view the previous 
code was super easy to understand. This code is not. Instead of getting rid of 
the entity cache concept completely, we are keeping it and making the code much 
less readable.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Leak of qd_connector_t (coverity)
> ---------------------------------
>
>                 Key: DISPATCH-2207
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-2207
>             Project: Qpid Dispatch
>          Issue Type: Bug
>          Components: Router Node
>    Affects Versions: 1.16.1
>            Reporter: Ken Giusti
>            Assignee: Ken Giusti
>            Priority: Major
>             Fix For: 1.17.0
>
>
> /home/kgiusti/work/dispatch/qpid-dispatch/src/server.c: 1358 in try_open_cb()
>  1352             // else deleted or failed - on failed wait until after 
> connection is freed
>  1353             // and state is set to CXTR_STATE_CONNECTING (timer is 
> rescheduled then)
>  1354             try_open_lh(ct, ctx);
>  1355         }
>  1356     
>  1357         sys_mutex_unlock(ct->lock);
>  >>>     CID 372106:  Resource leaks  (RESOURCE_LEAK)
>  >>>     Variable "ctx" going out of scope leaks the storage it points to.
>  1358     }
>  1359     
>  1360     
>  1361     qd_server_t *qd_server(qd_dispatch_t *qd, int thread_count, const 
> char *container_name,
>  1362                            const char *sasl_config_path, const char 
> *sasl_config_name)
>  1363     {



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to