summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipdfm-x/pdfcolor.c
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-07-04 03:26:54 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-07-04 03:26:54 +0000
commitf2087774db76f092475e93e121925f8a3b00fc55 (patch)
treea0f90eca500d51f0052f1f8c618e9ed1a4970f12 /Build/source/texk/dvipdfm-x/pdfcolor.c
parent6d013a8c5100b9160835ec9a9a82dc10bfe6551b (diff)
Fix a bug in pdfcolor.c. Add initialization and NULL pointer check. (S. Hirata)
git-svn-id: svn://tug.org/texlive/trunk@55746 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x/pdfcolor.c')
-rw-r--r--Build/source/texk/dvipdfm-x/pdfcolor.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfcolor.c b/Build/source/texk/dvipdfm-x/pdfcolor.c
index 55b26484b98..579a7e44d5f 100644
--- a/Build/source/texk/dvipdfm-x/pdfcolor.c
+++ b/Build/source/texk/dvipdfm-x/pdfcolor.c
@@ -173,9 +173,10 @@ pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f)
{
ASSERT(dst && src);
- if (dst->type != PDF_COLORSPACE_TYPE_RGB &&
- dst->type != PDF_COLORSPACE_TYPE_CMYK &&
- dst->type != PDF_COLORSPACE_TYPE_GRAY) {
+ if (src->type != PDF_COLORSPACE_TYPE_RGB &&
+ src->type != PDF_COLORSPACE_TYPE_CMYK &&
+ src->type != PDF_COLORSPACE_TYPE_GRAY) {
+ pdf_color_copycolor(dst, src);
return;
}
@@ -185,7 +186,8 @@ pdf_color_brighten_color (pdf_color *dst, const pdf_color *src, double f)
double f0, f1;
int n;
- n = dst->num_components = src->num_components;
+ pdf_color_copycolor(dst, src);
+ n = src->num_components;
f1 = n == 4 ? 0.0 : f; /* n == 4 is CMYK, others are RGB and Gray */
f0 = 1.0-f;
@@ -442,8 +444,10 @@ pdf_color_clear_stack (void)
WARN("You've mistakenly made a global color change within nested colors.");
}
while (color_stack.current--) {
- free(color_stack.stroke[color_stack.current].spot_color_name);
- free(color_stack.fill[color_stack.current].spot_color_name);
+ if (color_stack.stroke[color_stack.current].spot_color_name)
+ RELEASE(color_stack.stroke[color_stack.current].spot_color_name);
+ if (color_stack.fill[color_stack.current].spot_color_name)
+ RELEASE(color_stack.fill[color_stack.current].spot_color_name);
}
color_stack.current = 0;
pdf_color_black(color_stack.stroke);