Commit c61e75b4 authored by Brenden Blanco's avatar Brenden Blanco

Add check for fd < 0 in perf_reader_free

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 8207d10e
......@@ -54,7 +54,8 @@ void perf_reader_free(void *ptr) {
if (ptr) {
struct perf_reader *reader = ptr;
munmap(reader->base, reader->page_size * (reader->page_cnt + 1));
close(reader->fd);
if (reader->fd >= 0)
close(reader->fd);
free(reader->buf);
free(ptr);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment