PengZheng commented on code in PR #448: URL: https://github.com/apache/celix/pull/448#discussion_r1035503277
########## 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: My fault. ########## 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); Review Comment: It's my fault. `pubsub_tcpHandler_freeEntry` takes care of the fd. ########## bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c: ########## @@ -608,6 +610,8 @@ int pubsub_tcpHandler_listen(pubsub_tcpHandler_t *handle, char *url) { celixThreadRwlock_unlock(&handle->dbLock); } else { L_ERROR("[TCP Socket] Error listen socket cannot bind to %s: %s\n", url ? url : "", strerror(errno)); + free(pUrl); Review Comment: missing `free(sin)`. Let's put `free(sin); free(pUrl)` right after `entry = pubsub_tcpHandler_createEntry(handle, fd, pUrl, NULL, sin);`, so that we can remove them from both branches. -- 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