fix two minor free after use errors

fix two minor free after use errors.