diff --git a/tools/perf/util/cgroup.c b/tools/perf/util/cgroup.c index b73fb78230486005f6017238b0682f074086065e..050dea9f1e884d0203da34826c9cb0b8380e08a5 100644 --- a/tools/perf/util/cgroup.c +++ b/tools/perf/util/cgroup.c @@ -107,7 +107,8 @@ static int add_cgroup(struct evlist *evlist, const char *str) static void cgroup__delete(struct cgroup *cgroup) { - close(cgroup->fd); + if (cgroup->fd >= 0) + close(cgroup->fd); zfree(&cgroup->name); free(cgroup); }