1diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c
2index 298648a77..2374d459f 100644
3--- a/third_party/libopenjpeg20/jp2.c
4+++ b/third_party/libopenjpeg20/jp2.c
5@@ -1116,7 +1116,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image,
6         /* Prevent null pointer access */
7         if (!src || !dst) {
8           for (j = 0; j < nr_channels; ++j) {
9-            opj_free(new_comps[j].data);
10+            opj_image_data_free(new_comps[j].data);
11           }
12           opj_free(new_comps);
13           new_comps = NULL;
14