mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
properly free and unmap memory in closeFrameBuffer
This commit is contained in:
10
einkfb.c
10
einkfb.c
@@ -140,13 +140,15 @@ static int closeFrameBuffer(lua_State *L) {
|
||||
// should be save if called twice
|
||||
if(fb->buf != NULL && fb->buf->data != NULL) {
|
||||
#ifndef EMULATE_READER
|
||||
munmap(fb->buf->data, fb->finfo.smem_len);
|
||||
if (fb->vinfo.bits_per_pixel != 4) {
|
||||
munmap(fb->read_buf->data, fb->finfo.smem_len);
|
||||
free(fb->buf->data);
|
||||
} else {
|
||||
munmap(fb->buf->data, fb->finfo.smem_len);
|
||||
}
|
||||
close(fb->fd);
|
||||
#else
|
||||
free(fb->buf->data);
|
||||
if (fb->vinfo.bits_per_pixel != 4) {
|
||||
free(fb->real_buf->data);
|
||||
}
|
||||
#endif
|
||||
fb->buf->data = NULL;
|
||||
// the blitbuffer in fb->buf should be freed
|
||||
|
||||
Reference in New Issue
Block a user