Skip to content

Commit 2ca52ae

Browse files
authored
Merge pull request #2642 from fengzeroz/main
fix(connection): close fd if ip invalid
2 parents 88e5fc8 + 989421f commit 2ca52ae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/connection/connection.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ static void conn_connect(neu_conn_t *conn)
871871
} else {
872872
zlog_error(conn->param.log, "invalid ip: %s",
873873
conn->param.params.tcp_server.ip);
874+
close(fd);
874875
return;
875876
}
876877

@@ -941,6 +942,7 @@ static void conn_connect(neu_conn_t *conn)
941942
} else {
942943
zlog_error(conn->param.log, "invalid ip: %s",
943944
conn->param.params.tcp_server.ip);
945+
close(fd);
944946
return;
945947
}
946948

0 commit comments

Comments
 (0)