Commit fccdd364 authored by Tommi Rantala's avatar Tommi Rantala

Call close() only if opened

Valgrind was complaining:
==9103== Warning: invalid file descriptor -1 in syscall close()
==9103== Warning: invalid file descriptor -1 in syscall close()
parent 5eaa5783
......@@ -104,6 +104,7 @@ AttachedProbe::AttachedProbe(Probe &probe, std::tuple<uint8_t *, uintptr_t> func
AttachedProbe::~AttachedProbe()
{
if (progfd_ >= 0)
close(progfd_);
int err = 0;
......
......@@ -101,6 +101,7 @@ Map::Map(enum bpf_map_type map_type)
Map::~Map()
{
if (mapfd_ >= 0)
close(mapfd_);
}
......
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