diff options
-rw-r--r-- | base/gdevprn.c | 5 | ||||
-rw-r--r-- | base/gxclist.c | 15 |
2 files changed, 13 insertions, 7 deletions
diff --git a/base/gdevprn.c b/base/gdevprn.c index b94542805..3518ce6fe 100644 --- a/base/gdevprn.c +++ b/base/gdevprn.c | |||
@@ -233,6 +233,7 @@ gdev_prn_setup_as_command_list(gx_device *pdev, gs_memory_t *buffer_memory, | |||
233 | gx_device_clist_common * const pcldev = &pclist_dev->common; | 233 | gx_device_clist_common * const pcldev = &pclist_dev->common; |
234 | bool reallocate = *the_memory != 0; | 234 | bool reallocate = *the_memory != 0; |
235 | byte *base; | 235 | byte *base; |
236 | bool save_is_open = pdev->is_open; /* Save around temporary failure in open_c loop */ | ||
236 | 237 | ||
237 | while (target->parent != NULL) { | 238 | while (target->parent != NULL) { |
238 | target = target->parent; | 239 | target = target->parent; |
@@ -303,8 +304,10 @@ open_c: | |||
303 | "cmd list buf(retry open)"); | 304 | "cmd list buf(retry open)"); |
304 | } | 305 | } |
305 | ppdev->buf = *the_memory; | 306 | ppdev->buf = *the_memory; |
306 | if (base != 0) | 307 | if (base != 0) { |
308 | pdev->is_open = save_is_open; /* allow for success when we loop */ | ||
307 | goto open_c; | 309 | goto open_c; |
310 | } | ||
308 | } | 311 | } |
309 | /* Failure. */ | 312 | /* Failure. */ |
310 | if (!reallocate) { | 313 | if (!reallocate) { |
diff --git a/base/gxclist.c b/base/gxclist.c index 07ed6e9dd..14b825ccf 100644 --- a/base/gxclist.c +++ b/base/gxclist.c | |||
@@ -703,19 +703,22 @@ clist_open(gx_device *dev) | |||
703 | 703 | ||
704 | code = clist_init(dev); | 704 | code = clist_init(dev); |
705 | if (code < 0) | 705 | if (code < 0) |
706 | return code; | 706 | goto errxit; |
707 | |||
707 | cdev->icc_cache_list_len = 0; | 708 | cdev->icc_cache_list_len = 0; |
708 | cdev->icc_cache_list = NULL; | 709 | cdev->icc_cache_list = NULL; |
709 | code = clist_open_output_file(dev); | 710 | code = clist_open_output_file(dev); |
710 | if ( code >= 0) | 711 | if ( code >= 0) |
711 | code = clist_emit_page_header(dev); | 712 | code = clist_emit_page_header(dev); |
712 | if (code >= 0) { | 713 | if (code >= 0) { |
713 | dev->is_open = save_is_open; | 714 | dev->is_open = save_is_open; |
714 | } else { | 715 | return code; /* success */ |
715 | gs_free_object(cdev->memory->non_gc_memory, cdev->cache_chunk, "free tile cache for clist"); | ||
716 | cdev->cache_chunk = NULL; | ||
717 | } | 716 | } |
718 | 717 | /* fall through to clean up and return error code */ | |
718 | errxit: | ||
719 | /* prevent leak */ | ||
720 | gs_free_object(cdev->memory->non_gc_memory, cdev->cache_chunk, "free tile cache for clist"); | ||
721 | cdev->cache_chunk = NULL; | ||
719 | return code; | 722 | return code; |
720 | } | 723 | } |
721 | 724 | ||