[File] [PATCH] buffer_fill: fix double free of `ebuf` on read error

Kamil Dudka kdudka at redhat.com
Mon Jun 10 12:06:05 UTC 2019


Bug: https://bugzilla.redhat.com/1685217
---
 src/buffer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/buffer.c b/src/buffer.c
index 6d8967d2..de9eace8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -77,6 +77,7 @@ buffer_fill(const struct buffer *bb)
 	b->eoff = b->st.st_size - b->elen;
 	if (pread(b->fd, b->ebuf, b->elen, b->eoff) == -1) {
 		free(b->ebuf);
+		b->ebuf = NULL;
 		goto out;
 	}
 
-- 
2.20.1



More information about the File mailing list