Fix memory leaks

While looking for another memory leak I found this other two in the current master.