Release memory resource on cuda driver attach failure.
Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>