1234567891011121314151617181920 |
- Subject: Fix leak on error, found by coverity
- Origin: FILE5_34-15-ge0805be4 <https://github.com/file/file/commit/FILE5_34-15-ge0805be4>
- Upstream-Author: Christos Zoulas <christos@zoulas.com>
- Date: Wed Aug 1 09:59:45 2018 +0000
- --- a/src/compress.c
- +++ b/src/compress.c
- @@ -247,8 +247,11 @@
- * XXX: If file_buffer fails here, we overwrite
- * the compressed text. FIXME.
- */
- - if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
- + if (file_buffer(ms, -1, NULL, buf, nbytes) == -1) {
- + if (file_pop_buffer(ms, pb) != NULL)
- + abort();
- goto error;
- + }
- if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
- if (file_printf(ms, "%s", rbuf) == -1) {
- free(rbuf);
|