Skip to content

Commit

Permalink
openslideload oops
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Oct 3, 2023
1 parent 3b48a7c commit 93aeb4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions libvips/foreign/openslideload.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,21 @@ vips__openslide_get_associated(ReadSlide *rslide, const char *associated_name)
#ifdef HAVE_OPENSLIDE_ICC
int64_t len;
if ((len = openslide_get_associated_image_icc_profile_size(rslide->osr,
associated_name))) {
associated_name)) > 0) {
void *data;

if (!(data = VIPS_MALLOC(NULL, len)))
return -1;
if (!(data = VIPS_MALLOC(NULL, len))) {
g_object_unref(associated);
return NULL;
}
openslide_read_associated_image_icc_profile(rslide->osr,
associated_name, data);
error = openslide_get_error(rslide->osr);
if (error) {
g_free(data);
g_object_unref(associated);
vips_error("openslide2vips", _( "opening slide: %s" ), error);
return -1;
return NULL;
}

vips_image_set_blob(associated, VIPS_META_ICC_NAME,
Expand Down Expand Up @@ -637,7 +640,7 @@ readslide_parse(ReadSlide *rslide, VipsImage *image)

#ifdef HAVE_OPENSLIDE_ICC
int64_t len;
if ((len = openslide_get_icc_profile_size(rslide->osr))) {
if ((len = openslide_get_icc_profile_size(rslide->osr)) > 0) {
void *data;

if (!(data = VIPS_MALLOC(NULL, len)))
Expand Down

0 comments on commit 93aeb4e

Please sign in to comment.