diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index bd00d148f6b..a9b1a814688 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -1078,7 +1078,9 @@ func (cs *ControllerServer) CreateSnapshot( // Fetch source volume information rbdVol, err := GenVolFromVolID(ctx, req.GetSourceVolumeId(), cr, req.GetSecrets()) - defer rbdVol.Destroy() + if rbdVol != nil { + defer rbdVol.Destroy() + } if err != nil { switch { case errors.Is(err, ErrImageNotFound):