rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit d02775863afa8efc751e5f31618fb7e517e3bb61
parent ed2915ddbe0ac2694fd8f108f877f6c32ec713ef
Author: vaplv <vaplv@free.fr>
Date:   Fri, 26 May 2017 14:52:30 +0200

Fix the big_buffer release function

On release invocation, buffered data are flushed into the stream of the
big_buffer. However, the buffer containing the buffered data were freed
priorly to the flush, leading to invalid memory reads.

Diffstat:
Msrc/big_buffer.h | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/big_buffer.h b/src/big_buffer.h @@ -229,11 +229,11 @@ static INLINE void BIGBUF_FUNC__(release)(struct BIGBUF__* bigbuf) { ASSERT(bigbuf); - if(bigbuf->buf.data) MEM_RM(bigbuf->allocator, bigbuf->buf.data); if(bigbuf->file) { CHECK(BIGBUF_FUNC__(flush)(bigbuf), RES_OK); if(bigbuf->temp_file) fclose(bigbuf->file); } + if(bigbuf->buf.data) MEM_RM(bigbuf->allocator, bigbuf->buf.data); } static INLINE res_T