|
|
dfeaf0 |
From 7bd1d499157caa391082f594d197f49f5327bd56 Mon Sep 17 00:00:00 2001
|
|
|
dfeaf0 |
From: Christos Zoulas <christos@zoulas.com>
|
|
|
dfeaf0 |
Date: Wed, 1 Aug 2018 09:59:45 +0000
|
|
|
dfeaf0 |
Subject: [PATCH] fix leak on error, found by coverity.
|
|
|
dfeaf0 |
|
|
|
dfeaf0 |
Upstream-commit: e0805be4909e47dac47bab9d0caf3725da43e645
|
|
|
dfeaf0 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
dfeaf0 |
---
|
|
|
dfeaf0 |
src/compress.c | 5 ++++-
|
|
|
dfeaf0 |
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
dfeaf0 |
|
|
|
dfeaf0 |
diff --git a/src/compress.c b/src/compress.c
|
|
|
dfeaf0 |
index 184011b..cb11303 100644
|
|
|
dfeaf0 |
--- a/src/compress.c
|
|
|
dfeaf0 |
+++ b/src/compress.c
|
|
|
dfeaf0 |
@@ -249,8 +249,11 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
|
|
|
dfeaf0 |
* XXX: If file_buffer fails here, we overwrite
|
|
|
dfeaf0 |
* the compressed text. FIXME.
|
|
|
dfeaf0 |
*/
|
|
|
dfeaf0 |
- if (file_buffer(ms, -1, NULL, buf, nbytes) == -1)
|
|
|
dfeaf0 |
+ if (file_buffer(ms, -1, NULL, buf, nbytes) == -1) {
|
|
|
dfeaf0 |
+ if (file_pop_buffer(ms, pb) != NULL)
|
|
|
dfeaf0 |
+ abort();
|
|
|
dfeaf0 |
goto error;
|
|
|
dfeaf0 |
+ }
|
|
|
dfeaf0 |
if ((rbuf = file_pop_buffer(ms, pb)) != NULL) {
|
|
|
dfeaf0 |
if (file_printf(ms, "%s", rbuf) == -1) {
|
|
|
dfeaf0 |
free(rbuf);
|
|
|
dfeaf0 |
--
|
|
|
dfeaf0 |
2.17.2
|
|
|
dfeaf0 |
|