[kbdlogger] Added verification before deallocation on exit

Change-Id: Id2697214799f2951f300700f2d77a3c2403dac06