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