Skip to content

Commit 5e97e44

Browse files
committed
http: compression: Add a missed nxt_http_comp_compress() return check
In nxt_http_comp_compress_static_response() we should check the return value of the call to nxt_http_comp_compress() in case of error. Signed-off-by: Andrew Clayton <[email protected]>
1 parent 6482e46 commit 5e97e44

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/nxt_http_compression.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ nxt_http_comp_compress_static_response(nxt_task_t *task, nxt_http_request_t *r,
305305

306306
cbytes = nxt_http_comp_compress(out + *out_total, out_size - *out_total,
307307
in + in_size - rest, n, last);
308+
if (cbytes == -1) {
309+
nxt_file_close(task, &tfile);
310+
nxt_mem_munmap(in, in_size);
311+
nxt_mem_munmap(out, out_size);
312+
return NXT_ERROR;
313+
}
308314

309315
*out_total += cbytes;
310316
rest -= n;

0 commit comments

Comments
 (0)