diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/link.c | 8 | ||||
-rw-r--r-- | source/xps/xps-doc.c | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/fitz/link.c b/source/fitz/link.c index 152d48ea..20668ab1 100644 --- a/source/fitz/link.c +++ b/source/fitz/link.c @@ -6,7 +6,9 @@ fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest) switch (dest->kind) { case FZ_LINK_NONE: + break; case FZ_LINK_GOTO: + fz_free(ctx, dest->ld.gotor.dest); break; case FZ_LINK_URI: fz_free(ctx, dest->ld.uri.uri); @@ -47,15 +49,13 @@ fz_new_link(fz_context *ctx, const fz_rect *bbox, fz_link_dest dest) fz_link * fz_keep_link(fz_context *ctx, fz_link *link) { - if (link) - link->refs++; - return link; + return fz_keep_imp(ctx, link, &link->refs); } void fz_drop_link(fz_context *ctx, fz_link *link) { - while (link && --link->refs == 0) + while (fz_drop_imp(ctx, link, &link->refs)) { fz_link *next = link->next; fz_drop_link_dest(ctx, &link->dest); diff --git a/source/xps/xps-doc.c b/source/xps/xps-doc.c index ec12e87a..6f45b431 100644 --- a/source/xps/xps-doc.c +++ b/source/xps/xps-doc.c @@ -137,6 +137,7 @@ xps_add_link(fz_context *ctx, xps_document *doc, const fz_rect *area, char *base dest.ld.gotor.page = target->page; dest.ld.gotor.file_spec = NULL; dest.ld.gotor.new_window = 0; + dest.ld.gotor.dest = NULL; } link = fz_new_link(ctx, area, dest); |