summaryrefslogtreecommitdiff
path: root/psi/zpcolor.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2018-02-06 10:30:32 +0000
committerKen Sharp <ken.sharp@artifex.com>2018-02-06 10:30:32 +0000
commit16688a8b833cf4e8950265e933604c32b1f2392e (patch)
tree6c10311dbce4d9ee8eb113ebbef5e381c8fa3282 /psi/zpcolor.c
parent650aae633131396b802b2cae6e09afbd5aae6ad6 (diff)
downloadghostpdl-16688a8b833cf4e8950265e933604c32b1f2392e.tar.gz
Address more scanbuild/gcc/clang warnings
gp_os2.c free buffer and close file on memory full (as per other error conditions). gscicach.c remove unnecessary assignment gsdparam.c " " " " gxfapi.c " " " " gscscie.c check a return code zicc.c " " " " zpcolor.c " " " " mkromfs.c If realloc should fail in process_path, free working memory print an error and exit as per other error conditions. zcolor.c ensure depth cannot be 0. This should not be possible, no existing code causes this, but its best to be safe and it prevents a possible unassigned pointer dereference (possibly NULL) which is what scanbuild complains of. Best to catch this in the interpreter.
Diffstat (limited to 'psi/zpcolor.c')
-rw-r--r--psi/zpcolor.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/psi/zpcolor.c b/psi/zpcolor.c
index 78e6481ac..41e23d36b 100644
--- a/psi/zpcolor.c
+++ b/psi/zpcolor.c
@@ -395,7 +395,7 @@ pattern_paint_cleanup(i_ctx_t *i_ctx_p)
r_ptr(esp + 4, gx_device_pattern_accum);
gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)gs_currentcolor(igs->saved)->pattern;
gs_pattern1_instance_t *pinst2 = r_ptr(esp + 3, gs_pattern1_instance_t);
- int code, i;
+ int code, i, ecode=0;
/* If the PaintProc does one or more gsaves, then encounters an error, we can get
* here with the graphics state stack not how we expect.
* Hence we stored a reference to the pattern instance on the exec stack, and that
@@ -425,10 +425,13 @@ pattern_paint_cleanup(i_ctx_t *i_ctx_p)
param.graphics_state = (void *)igs;
param.pinst_id = pinst->id;
- code = dev_proc(cdev, dev_spec_op)(cdev,
+ ecode = dev_proc(cdev, dev_spec_op)(cdev,
gxdso_pattern_finish_accum, &param, sizeof(pattern_accum_param_s));
}
code = gs_grestore(igs);
gx_unset_dev_color(igs); /* dev_color may need updating if GC ran */
+
+ if (ecode < 0)
+ return ecode;
return code;
}