PengZheng commented on code in PR #448: URL: https://github.com/apache/celix/pull/448#discussion_r1035510287
########## bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c: ########## @@ -571,13 +571,15 @@ int pubsub_tcpHandler_listen(pubsub_tcpHandler_t *handle, char *url) { if (rc != 0) { L_ERROR("[TCP Socket] Error listen: %s\n", strerror(errno)); pubsub_tcpHandler_freeEntry(entry); + close(fd); entry = NULL; } } if (rc >= 0) { rc = pubsub_tcpHandler_makeNonBlocking(handle, fd); if (rc < 0) { pubsub_tcpHandler_freeEntry(entry); + close(fd); Review Comment: If `handle->efd < 0`, then `entry` will also be leaked. I think in this `if(entry != NULL)` branch, we only need one `pubsub_tcpHandler_freeEntry`: ```C if ((rc >= 0) && (handle->efd >= 0)) { } else { pubsub_tcpHandler_freeEntry(entry); } ``` Others are superfluous and can be removed. -- 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: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org