plugins: don't panic on Close if PluginServer nil #5327
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #5317
- What I did
We had a report in fixes #5317 of a panic at
cli/cli-plugins/socket/socket.go
Line 111 in 87c6624
Looks like this will happen if the call to create a
PluginServer
fails and returns nil, since we're not checking for nilness before attempting to callClose
:cli/cmd/docker/docker.go
Lines 247 to 251 in 87c6624
cli/cmd/docker/docker.go
Line 278 in 87c6624
- How I did it
Added a nil check to
PluginServer.Close()
. We could also have addressed this at the caller sites, but this seems more robust for little cost.- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)