Fix memory leak + "invalid read" in pwsafe formats