[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-1013-g72fe930
Michael Vrhel
mvrhel at ghostscript.com
Thu Mar 15 19:08:31 UTC 2012
The ghostpdl branch, master has been updated
via 72fe9304f98beff3c97347d6e402bb812136de49 (commit)
from 82d1d263a13ccfe64e78cd0e6f1cf1a275adcb9c (commit)
----------------------------------------------------------------------
commit 72fe9304f98beff3c97347d6e402bb812136de49
Author: Michael Vrhel <michael.vrhel at artifex.com>
Date: Thu Mar 15 09:58:51 2012 -0700
Fix for memory issue in icc user params
The icc user parameters where improperly being set as being persistent
for the user params list when they were not. In the case when we are
using the output intent profile, one of the default profiles is freed
and replaced by the output intent profile. In this case, the default
profile contained the string that was used for the user params. During
a VMreclaim, we would then go and restore the user params and
unfortunately this default one had been freed.
diff --git a/gs/base/gsicc_manage.c b/gs/base/gsicc_manage.c
index 7e0f392..0b2e7d9 100644
--- a/gs/base/gsicc_manage.c
+++ b/gs/base/gsicc_manage.c
@@ -1997,10 +1997,15 @@ gs_currentdevicenicc(const gs_state * pgs, gs_param_string * pval)
/*FIXME: This should return the entire list !!! */
/* Just return the first one for now */
- pval->data = (const byte *)( (pgs->icc_manager->device_n == NULL) ?
- rfs : pgs->icc_manager->device_n->head->iccprofile->name);
+ if (pgs->icc_manager->device_n == NULL) {
+ pval->data = (const byte *) rfs;
+ pval->persistent = true;
+ } else {
+ pval->data =
+ (const byte *) (pgs->icc_manager->device_n->head->iccprofile->name);
+ pval->persistent = false;
+ }
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
}
int
@@ -2054,10 +2059,14 @@ gs_currentdefaultgrayicc(const gs_state * pgs, gs_param_string * pval)
{
static const char *const rfs = DEFAULT_GRAY_ICC;
- pval->data = (const byte *)( (pgs->icc_manager->default_gray == NULL) ?
- rfs : pgs->icc_manager->default_gray->name);
+ if (pgs->icc_manager->default_gray == NULL) {
+ pval->data = (const byte *) rfs;
+ pval->persistent = true;
+ } else {
+ pval->data = (const byte *) (pgs->icc_manager->default_gray->name);
+ pval->persistent = false;
+ }
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
}
int
@@ -2104,11 +2113,12 @@ gs_currenticcdirectory(const gs_state * pgs, gs_param_string * pval)
if (lib_ctx->profiledir == NULL) {
pval->data = (const byte *)rfs;
pval->size = strlen(rfs);
+ pval->persistent = true;
} else {
pval->data = (const byte *)(lib_ctx->profiledir);
pval->size = lib_ctx->profiledir_len;
+ pval->persistent = false;
}
- pval->persistent = true;
}
int
@@ -2142,7 +2152,7 @@ gs_currentsrcgtagicc(const gs_state * pgs, gs_param_string * pval)
} else {
pval->data = (byte *)pgs->icc_manager->srcgtag_profile->name;
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
+ pval->persistent = false;
}
}
@@ -2171,10 +2181,14 @@ gs_currentdefaultrgbicc(const gs_state * pgs, gs_param_string * pval)
{
static const char *const rfs = DEFAULT_RGB_ICC;
- pval->data = (const byte *)( (pgs->icc_manager->default_rgb == NULL) ?
- rfs : pgs->icc_manager->default_rgb->name);
+ if (pgs->icc_manager->default_rgb == NULL) {
+ pval->data = (const byte *) rfs;
+ pval->persistent = true;
+ } else {
+ pval->data = (const byte *) (pgs->icc_manager->default_rgb->name);
+ pval->persistent = false;
+ }
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
}
int
@@ -2203,10 +2217,14 @@ gs_currentnamedicc(const gs_state * pgs, gs_param_string * pval)
{
static const char *const rfs = "";
- pval->data = (const byte *)( (pgs->icc_manager->device_named == NULL) ?
- rfs : pgs->icc_manager->device_named->name);
+ if (pgs->icc_manager->device_named == NULL) {
+ pval->data = (const byte *) rfs;
+ pval->persistent = true;
+ } else {
+ pval->data = (const byte *) (pgs->icc_manager->device_named->name);
+ pval->persistent = false;
+ }
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
}
int
@@ -2239,10 +2257,14 @@ gs_currentdefaultcmykicc(const gs_state * pgs, gs_param_string * pval)
{
static const char *const rfs = DEFAULT_CMYK_ICC;
- pval->data = (const byte *)( (pgs->icc_manager->default_cmyk == NULL) ?
- rfs : pgs->icc_manager->default_cmyk->name);
+ if (pgs->icc_manager->default_cmyk == NULL) {
+ pval->data = (const byte *) rfs;
+ pval->persistent = true;
+ } else {
+ pval->data = (const byte *) (pgs->icc_manager->default_cmyk->name);
+ pval->persistent = false;
+ }
pval->size = strlen((const char *)pval->data);
- pval->persistent = true;
}
int
Summary of changes:
gs/base/gsicc_manage.c | 56 +++++++++++++++++++++++++++++++++--------------
1 files changed, 39 insertions(+), 17 deletions(-)
More information about the gs-commits
mailing list