From: John Tsiombikas Date: Mon, 25 Nov 2019 14:59:27 +0000 (+0200) Subject: fixed: tried to free mapped buffer, unmap if mapped, free otherwise, X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=visor;a=commitdiff_plain;h=8bf8b3066f32093ee83cb52e720002ea7dc94250 fixed: tried to free mapped buffer, unmap if mapped, free otherwise, also close the file --- diff --git a/libvisor/src/visor.c b/libvisor/src/visor.c index 86d508b..2c93521 100644 --- a/libvisor/src/visor.c +++ b/libvisor/src/visor.c @@ -215,8 +215,16 @@ int vi_delete_buf(struct visor *vi, struct vi_buffer *vb) return -1; } + if(vb->fp) { + if(vb->file_mapped) { + vi_unmap(vb->fp); + } else { + vi_free(vb->orig); + } + vi_close(vb->fp); + } + vi_free(vb->path); - vi_free(vb->orig); vi_free(vb->add); vi_free(vb->spans); return 0;