Do not segfault on hard stop

Podman machine on MAC can segfault on hard stop.

Fixes: 23654

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2024-08-19 09:34:55 -04:00
parent 7899358ec9
commit fc30620cdb
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
1 changed files with 3 additions and 1 deletions

View File

@ -83,7 +83,9 @@ func (vf *Helper) stateChange(newState rest.StateChange) error {
}
payload := bytes.NewReader(b)
serverResponse, err := vf.post(vf.Endpoint+state, payload)
_ = serverResponse.Body.Close()
if err == nil {
_ = serverResponse.Body.Close()
}
return err
}