fixed memleaks and etc.

fixed memory leaks
fixed possible buffer overflow on scanf(), sprintf()
fixed incorrect secret key wipe
fixed unsigned value comparison with below zero
fixed radstatus result checking