eina evlog debugging - when freeing debug buf with mmap 0 size after
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 28 Jul 2017 12:12:57 +0000 (21:12 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 29 Jul 2017 00:08:40 +0000 (09:08 +0900)
munmap would not munmap the memory with  a size of 0... so zero the
size after the munmap.

found by PVS studio

@fix

src/lib/eina/eina_evlog.c

index dca1e22..90af610 100644 (file)
@@ -111,14 +111,14 @@ static void
 free_buf(Eina_Evlog_Buf *b)
 {
    if (!b->buf) return;
-   b->size = 0;
-   b->top = 0;
 # ifdef HAVE_MMAP
    munmap(b->buf, b->size);
 # else
    free(b->buf);
 # endif
    b->buf = NULL;
+   b->size = 0;
+   b->top = 0;
 }
 
 static inline void *