Skip to content

Commit 6676753

Browse files
authored
Merge pull request #12 from OpenCloudOS/future
fix file not released error in parse_reason_enum()
2 parents e88160c + 152ac7a commit 6676753

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/dropreason.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ static int parse_reason_enum()
3030
f = fopen("/sys/kernel/debug/tracing/events/skb/kfree_skb/format",
3131
"r");
3232

33-
if (!f || !fsearch(f, "__print_symbolic"))
33+
if (!f || !fsearch(f, "__print_symbolic")) {
34+
if (f)
35+
fclose(f);
3436
return -1;
37+
}
3538

3639
while (true) {
3740
if (!fsearch(f, "{") ||
@@ -41,6 +44,8 @@ static int parse_reason_enum()
4144
}
4245
drop_reason_max = index;
4346
drop_reason_inited = true;
47+
48+
fclose(f);
4449
return 0;
4550
}
4651

0 commit comments

Comments
 (0)