diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2011-08-18 17:01:43 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2011-09-28 10:19:43 -0700 |
commit | fe8d7b6aebfed3c724a860e31ff170764d5429dc (patch) | |
tree | 4d5becf42a9c872fcfc93336a50aab4677d3ef39 /gs/base/gsicc_profilecache.c | |
parent | 02bdba18be7f2b78ca03d3f4126cef830eab28eb (diff) |
Fix bug 692372: Add finalize for imager_state to ref_count decrement icc structs.
The graphics atates were being freed by the 'alloc_restore_all' done during gs_lib_finit
but the icc_link_cache was not getting its ref_count decremented, so it never freed the
semaphore which caused handles to be lost by windows. The rc_gsicc_profile_cache_free
function is also fixed to save the 'next' pointer to avoid dereferencing freed memory.
Note that we _should_ be able to call gs_imager_state_release to decrement the counts
of ALL of the elements, but the ref counting of the other elements is _so_ badly
maintained that some elements (dev_ht and halftone) are prematurely freed by this.
This change is enough to fix the bug and pass cluster regression.
Diffstat (limited to 'gs/base/gsicc_profilecache.c')
-rw-r--r-- | gs/base/gsicc_profilecache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gs/base/gsicc_profilecache.c b/gs/base/gsicc_profilecache.c index fcf01bdd7..80ec78fe3 100644 --- a/gs/base/gsicc_profilecache.c +++ b/gs/base/gsicc_profilecache.c @@ -66,14 +66,15 @@ static void rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname) { gsicc_profile_cache_t *profile_cache = (gsicc_profile_cache_t * ) ptr_in; - gsicc_profile_entry_t *curr = profile_cache->head; + gsicc_profile_entry_t *curr = profile_cache->head, *next; while (curr != NULL ){ + next = curr->next; rc_decrement(curr->color_space, "rc_gsicc_profile_cache_free"); gs_free_object(mem->stable_memory, curr, "rc_gsicc_profile_cache_free"); profile_cache->num_entries--; - curr = curr->next; + curr = next; } #ifdef DEBUG if (profile_cache->num_entries != 0) |