Fix some memory leaks

Signed-off-by: rpgmaker <olamide.bakre@gmail.com>