diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2005-03-07 13:52:51 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2005-03-07 13:52:51 +0000 |
commit | b40c11d963a0182953187616e465460086774369 (patch) | |
tree | b7331a28562b4462efc9959dd25f72bbb06259ec /sbin | |
parent | f3772d6a2b9d40f81fadaf1278db5efc3f644a0d (diff) |
fd leaks in error paths, From: Andrey Matveev <andrushock@korovino.net>
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 1a1527a57b9..2e628e51658 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.233 2005/03/06 02:40:08 dhartmei Exp $ */ +/* $OpenBSD: pfctl.c,v 1.234 2005/03/07 13:52:50 henning Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -1069,8 +1069,11 @@ pfctl_rules(int dev, char *filename, int opts, char *anchorname, if ((altqsupport && (pf.loadopt & PFCTL_FLAG_ALTQ) != 0)) if (check_commit_altq(dev, opts) != 0) ERRX("errors in altq config"); - if (fin != stdin) + + if (fin != stdin) { fclose(fin); + fin = NULL; + } /* process "load anchor" directives */ if (!anchorname[0]) @@ -1092,8 +1095,11 @@ _error: if (pfctl_trans(dev, t, DIOCXROLLBACK, 0)) err(1, "DIOCXROLLBACK"); exit(1); - } else /* sub ruleset */ + } else { /* sub ruleset */ + if (fin != NULL && fin != stdin) + fclose(fin); return (-1); + } #undef ERR #undef ERRX |