diff --git a/notifier/webhook/deliverer.go b/notifier/webhook/deliverer.go index 124a6b2233..5c7b29f07c 100644 --- a/notifier/webhook/deliverer.go +++ b/notifier/webhook/deliverer.go @@ -105,12 +105,10 @@ func (d *Deliverer) Deliver(ctx context.Context, nID uuid.UUID) error { Msg("dispatching webhook") resp, err := d.c.Do(req) - if resp != nil { - defer resp.Body.Close() - } if err != nil { return &clairerror.ErrDeliveryFailed{E: err} } + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { return &clairerror.ErrDeliveryFailed{ E: &clairerror.ErrRequestFail{