summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorEthan Vrhel <ethanvrhel@gmail.com>2022-06-27 13:38:23 -0700
committerEthan Vrhel <ethanvrhel@gmail.com>2022-06-27 14:56:22 -0700
commit532279f73778f3b33ed126a27b0e542581162be9 (patch)
tree3ef8f2787806088208b00eddd8d375b9a542a048 /xps
parent4dfa63fbb6d3049b9f462054aa786ca4b182d50a (diff)
downloadghostpdl-532279f73778f3b33ed126a27b0e542581162be9.tar.gz
Coverity 379207 fixed - control flow issues
Removed unnecessary control statement, and added new one for error checking.
Diffstat (limited to 'xps')
-rw-r--r--xps/xpszip.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/xps/xpszip.c b/xps/xpszip.c
index e07e516c1..14ac76751 100644
--- a/xps/xpszip.c
+++ b/xps/xpszip.c
@@ -495,25 +495,28 @@ xps_read_dir_part(xps_context_t *ctx, const char *name)
}
/* Inflate the pieces */
- if (count)
+
+ part = xps_new_part(ctx, name, size);
+ if (!part)
{
- part = xps_new_part(ctx, name, size);
- offset = 0;
- for (i = 0; i < count; i++)
- {
- if (i < count - 1)
- gs_snprintf(buf, sizeof(buf), "%s%s/[%d].piece", ctx->directory, name, i);
- else
- gs_snprintf(buf, sizeof(buf), "%s%s/[%d].last.piece", ctx->directory, name, i);
- file = gp_fopen(ctx->memory, buf, "rb");
- n = xps_fread(part->data + offset, 1, size - offset, file);
- offset += n;
- gp_fclose(file);
- }
- return part;
+ gs_rethrow1(-1, "failed to create part '%s'", name);
+ return NULL;
}
- return NULL;
+ offset = 0;
+ for (i = 0; i < count; i++)
+ {
+ if (i < count - 1)
+ gs_snprintf(buf, sizeof(buf), "%s%s/[%d].piece", ctx->directory, name, i);
+ else
+ gs_snprintf(buf, sizeof(buf), "%s%s/[%d].last.piece", ctx->directory, name, i);
+ file = gp_fopen(ctx->memory, buf, "rb");
+ n = xps_fread(part->data + offset, 1, size - offset, file);
+ offset += n;
+ gp_fclose(file);
+ }
+ return part;
+
}
xps_part_t *