Memory leak fixes

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>