Skip to content

Commit

Permalink
rbd: fixed csi-rbdplugin crashes when decoding volume ID failed
Browse files Browse the repository at this point in the history
Signed-off-by: HF <crazytaxii666@gmail.com>
  • Loading branch information
crazytaxii authored and mergify[bot] committed Sep 5, 2023
1 parent b3ef867 commit 80ad5b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,11 @@ func (cs *ControllerServer) DeleteVolume(
}

rbdVol, err := GenVolFromVolID(ctx, volumeID, cr, req.GetSecrets())
defer rbdVol.Destroy()
defer func() {
if rbdVol != nil {
rbdVol.Destroy()
}
}()
if err != nil {
return cs.checkErrAndUndoReserve(ctx, err, volumeID, rbdVol, cr)
}
Expand Down

0 comments on commit 80ad5b6

Please sign in to comment.