fix a couple of memory leaks

Change-Id: I04ec537899be387612e9076c7f2b06902cfde6e0
Signed-off-by: Alessandro Salvatori <sandr8@gmail.com>