summaryrefslogtreecommitdiff
path: root/base/gsicc.c
diff options
context:
space:
mode:
authorJulian Smith <jules@op59.net>2019-11-19 16:40:16 +0000
committerJulian Smith <jules@op59.net>2019-11-19 16:45:50 +0000
commite1b7dbc95945ef2afa38faeebfda56830f2762ab (patch)
tree0592d25066e20cd4c7cea54eea1c7684b996e845 /base/gsicc.c
parente93430d762400247cdc4550be403a1f7c291112d (diff)
downloadghostpdl-e1b7dbc95945ef2afa38faeebfda56830f2762ab.tar.gz
Coverity 350182: check for error before dereferencing ptr from gs_cspace_build_ICC().
This allows us to remove the check for pcs == NULL after pcs has already been dereferenced, which was the coverity issue. Also fixed gs_cspace_build_ICC() to return gs_error_VMerror if gs_cspace_alloc() fails - was returning zero with *ppcspace out-param set to NULL. Have checked that all callers don't rely on the out-param being NULL to indicate error. Though some of them make no checks at all.
Diffstat (limited to 'base/gsicc.c')
-rw-r--r--base/gsicc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/base/gsicc.c b/base/gsicc.c
index 5095d4f3e..4f26eda1a 100644
--- a/base/gsicc.c
+++ b/base/gsicc.c
@@ -623,6 +623,9 @@ gs_cspace_build_ICC(
gs_memory_t * pmem )
{
gs_color_space *pcspace = gs_cspace_alloc(pmem, &gs_color_space_type_ICC);
+ if (!pcspace) {
+ return_error(gs_error_VMerror);
+ }
*ppcspace = pcspace;
return 0;