Use opj_image_data_free() where appropriate (adapted from https://github.com/uclouvai...