libgutenprint: channel.c: Defer assigment after NULL check
To avoid hypothetical NULL dereference. CID 10821, CID 10822 (patch sent upstream)
This commit is contained in:
parent
3ad5b0818e
commit
5e783d6ad7
@ -736,9 +736,10 @@ limit_ink(const stp_vars_t *v)
|
||||
int i;
|
||||
int retval = 0;
|
||||
stpi_channel_group_t *cg = get_channel_group(v);
|
||||
unsigned short *ptr = cg->output_data;
|
||||
unsigned short *ptr;
|
||||
if (!cg || cg->ink_limit == 0 || cg->ink_limit >= cg->max_density)
|
||||
return 0;
|
||||
ptr = cg->output_data;
|
||||
for (i = 0; i < cg->width; i++)
|
||||
{
|
||||
int total_ink = ink_sum(ptr, cg->total_channels);
|
||||
@ -1065,11 +1066,12 @@ static void
|
||||
generate_gloss(const stp_vars_t *v, unsigned *zero_mask)
|
||||
{
|
||||
stpi_channel_group_t *cg = get_channel_group(v);
|
||||
unsigned short *output = cg->output_data;
|
||||
unsigned short *output;
|
||||
unsigned gloss_mask;
|
||||
int i, j, k;
|
||||
if (!cg || cg->gloss_channel == -1 || cg->gloss_limit <= 0)
|
||||
return;
|
||||
output = cg->output_data;
|
||||
gloss_mask = ~(1 << cg->gloss_physical_channel);
|
||||
for (i = 0; i < cg->width; i++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user