Skip to content

Commit

Permalink
fix panic.
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand committed Mar 14, 2023
1 parent 446686c commit 41e9f01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cdc/sink/dmlsink/mq/kafka_dml_sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewKafkaDMLSink(
// We must close adminClient when this func return cause by an error
// otherwise the adminClient will never be closed and lead to a goroutine leak.
defer func() {
if err != nil {
if err != nil && adminClient != nil {
adminClient.Close()
}
}()
Expand All @@ -86,7 +86,7 @@ func NewKafkaDMLSink(
// Preventing leaks when error occurs.
// This also closes the client in p.Close().
defer func() {
if err != nil {
if err != nil && p != nil {
p.Close()
}
}()
Expand Down

0 comments on commit 41e9f01

Please sign in to comment.