summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-05 19:27:18 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-05 19:27:18 +0000
commitce08a0d3a1e3f09c7841296715c8db4ab0e820c0 (patch)
tree6562990f6657e4e914184f2e674737fbdd5b48b0 /usr.sbin
parent46b7da6112e24e695d855defc83ff19c8cfb3787 (diff)
Remove two sets of NULL-checks before free().
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tcpdump/pfctl_osfp.c29
-rw-r--r--usr.sbin/tcpdump/privsep.c8
2 files changed, 13 insertions, 24 deletions
diff --git a/usr.sbin/tcpdump/pfctl_osfp.c b/usr.sbin/tcpdump/pfctl_osfp.c
index 95a4d9f5bd8..ac2ebf11db4 100644
--- a/usr.sbin/tcpdump/pfctl_osfp.c
+++ b/usr.sbin/tcpdump/pfctl_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_osfp.c,v 1.10 2015/01/20 18:26:58 deraadt Exp $ */
+/* $OpenBSD: pfctl_osfp.c,v 1.11 2015/12/05 19:27:17 mmcc Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@openbsd.org>
@@ -113,16 +113,11 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename)
buf[len -1] = '\n';
line = buf;
lineno++;
- if (class)
- free(class);
- if (version)
- free(version);
- if (subtype)
- free(subtype);
- if (desc)
- free(desc);
- if (tcpopts)
- free(tcpopts);
+ free(class);
+ free(version);
+ free(subtype);
+ free(desc);
+ free(tcpopts);
class = version = subtype = desc = tcpopts = NULL;
memset(&fp, 0, sizeof(fp));
@@ -251,14 +246,10 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename)
add_fingerprint(dev, opts, &fp);
}
- if (class)
- free(class);
- if (version)
- free(version);
- if (subtype)
- free(subtype);
- if (desc)
- free(desc);
+ free(class);
+ free(version);
+ free(subtype);
+ free(desc);
if (opts & PF_OPT_VERBOSE2)
printf("Loaded %d passive OS fingerprints\n",
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index 83b8dde0555..bd23597f338 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.39 2015/11/03 05:04:06 mmcc Exp $ */
+/* $OpenBSD: privsep.c,v 1.40 2015/12/05 19:27:17 mmcc Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -583,10 +583,8 @@ impl_getlines(int fd)
write_string(fd, buf);
- if (lbuf != NULL) {
- free(lbuf);
- lbuf = NULL;
- }
+ free(lbuf);
+ lbuf = NULL;
}
write_zero(fd);
fclose(fp);