Correct leak in color_cielab_to_rgb

This commit is contained in:
mayeut 2015-09-13 14:42:56 +02:00
parent e3579b6c1d
commit 49cbc11a19
3 changed files with 6 additions and 6 deletions

View File

@ -599,13 +599,13 @@ void color_apply_conversion(opj_image_t *image)
transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0); transform = cmsCreateTransform(in, TYPE_Lab_DBL, out, TYPE_RGB_16, INTENT_PERCEPTUAL, 0);
#ifdef HAVE_LIBLCMS2 #ifdef OPJ_HAVE_LIBLCMS2
cmsCloseProfile(in); cmsCloseProfile(in);
cmsCloseProfile(out); cmsCloseProfile(out);
#endif #endif
if(transform == NULL) if(transform == NULL)
{ {
#ifdef HAVE_LIBLCMS1 #ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in); cmsCloseProfile(in);
cmsCloseProfile(out); cmsCloseProfile(out);
#endif #endif
@ -662,7 +662,7 @@ void color_apply_conversion(opj_image_t *image)
*blue++ = RGB[2]; *blue++ = RGB[2];
} }
cmsDeleteTransform(transform); cmsDeleteTransform(transform);
#ifdef HAVE_LIBLCMS1 #ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in); cmsCloseProfile(in);
cmsCloseProfile(out); cmsCloseProfile(out);
#endif #endif
@ -681,7 +681,7 @@ void color_apply_conversion(opj_image_t *image)
fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs); fprintf(stderr,"%s:%d:\n\tenumCS %d not handled. Ignoring.\n", __FILE__,__LINE__, enumcs);
}// color_apply_conversion() }// color_apply_conversion()
#endif // HAVE_LIBLCMS2 || HAVE_LIBLCMS1 #endif // OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1
void color_cmyk_to_rgb(opj_image_t *image) void color_cmyk_to_rgb(opj_image_t *image)
{ {

View File

@ -40,7 +40,7 @@
extern void color_sycc_to_rgb(opj_image_t *img); extern void color_sycc_to_rgb(opj_image_t *img);
extern void color_apply_icc_profile(opj_image_t *image); extern void color_apply_icc_profile(opj_image_t *image);
extern void color_apply_conversion(opj_image_t *image); extern void color_cielab_to_rgb(opj_image_t *image);
extern void color_cmyk_to_rgb(opj_image_t *image); extern void color_cmyk_to_rgb(opj_image_t *image);
extern void color_esycc_to_rgb(opj_image_t *image); extern void color_esycc_to_rgb(opj_image_t *image);

View File

@ -1371,7 +1371,7 @@ int main(int argc, char **argv)
if(image->icc_profile_len) if(image->icc_profile_len)
color_apply_icc_profile(image); color_apply_icc_profile(image);
else else
color_apply_conversion(image); color_cielab_to_rgb(image);
#endif #endif
free(image->icc_profile_buf); free(image->icc_profile_buf);
image->icc_profile_buf = NULL; image->icc_profile_len = 0; image->icc_profile_buf = NULL; image->icc_profile_len = 0;