Skip to content

Commit 93aeb4e

Browse files
committed
openslideload oops
1 parent 3b48a7c commit 93aeb4e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

libvips/foreign/openslideload.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,18 +360,21 @@ vips__openslide_get_associated(ReadSlide *rslide, const char *associated_name)
360360
#ifdef HAVE_OPENSLIDE_ICC
361361
int64_t len;
362362
if ((len = openslide_get_associated_image_icc_profile_size(rslide->osr,
363-
associated_name))) {
363+
associated_name)) > 0) {
364364
void *data;
365365

366-
if (!(data = VIPS_MALLOC(NULL, len)))
367-
return -1;
366+
if (!(data = VIPS_MALLOC(NULL, len))) {
367+
g_object_unref(associated);
368+
return NULL;
369+
}
368370
openslide_read_associated_image_icc_profile(rslide->osr,
369371
associated_name, data);
370372
error = openslide_get_error(rslide->osr);
371373
if (error) {
372374
g_free(data);
375+
g_object_unref(associated);
373376
vips_error("openslide2vips", _( "opening slide: %s" ), error);
374-
return -1;
377+
return NULL;
375378
}
376379

377380
vips_image_set_blob(associated, VIPS_META_ICC_NAME,
@@ -637,7 +640,7 @@ readslide_parse(ReadSlide *rslide, VipsImage *image)
637640

638641
#ifdef HAVE_OPENSLIDE_ICC
639642
int64_t len;
640-
if ((len = openslide_get_icc_profile_size(rslide->osr))) {
643+
if ((len = openslide_get_icc_profile_size(rslide->osr)) > 0) {
641644
void *data;
642645

643646
if (!(data = VIPS_MALLOC(NULL, len)))

0 commit comments

Comments
 (0)