Merge pull request #590 from mayeut/master

Correct leak in color_cielab_to_rgb
This commit is contained in:
Matthieu Darbois 2015-09-13 14:55:13 +02:00
commit b4e8a425ae
3 changed files with 7 additions and 7 deletions

View File

@ -562,7 +562,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
#endif
}/* color_apply_icc_profile() */
void color_apply_conversion(opj_image_t *image)
void color_cielab_to_rgb(opj_image_t *image)
{
int *row;
int enumcs, numcomps;
@ -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);
#ifdef HAVE_LIBLCMS2
#ifdef OPJ_HAVE_LIBLCMS2
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
if(transform == NULL)
{
#ifdef HAVE_LIBLCMS1
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#endif
@ -662,7 +662,7 @@ void color_apply_conversion(opj_image_t *image)
*blue++ = RGB[2];
}
cmsDeleteTransform(transform);
#ifdef HAVE_LIBLCMS1
#ifdef OPJ_HAVE_LIBLCMS1
cmsCloseProfile(in);
cmsCloseProfile(out);
#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);
}// color_apply_conversion()
#endif // HAVE_LIBLCMS2 || HAVE_LIBLCMS1
#endif // OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1
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_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_esycc_to_rgb(opj_image_t *image);

View File

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