Merge "Structure device not freed in error case"