The deinit function in the 'error' section will correctly free everything.
Attach a file by drag & drop or click to upload