summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-12-09 19:36:18 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-12-09 19:36:18 +0000
commit4edce31b89a56272f3f73f0b7adb85e497cadaea (patch)
treef6603b963989cf249d8e3d56bda18873d5b1ae4a /bin
parent2bf61905cc5d921791da2b5a5b7be26c74c26b1a (diff)
Remove NULL-check before free(). ok tb@
Diffstat (limited to 'bin')
-rw-r--r--bin/md5/md5.c5
-rw-r--r--bin/systrace/filter.c11
-rw-r--r--bin/systrace/intercept-translate.c8
-rw-r--r--bin/systrace/intercept.c20
-rw-r--r--bin/systrace/openbsd-syscalls.c5
5 files changed, 18 insertions, 31 deletions
diff --git a/bin/md5/md5.c b/bin/md5/md5.c
index 2926c372fdf..fbe66dca298 100644
--- a/bin/md5/md5.c
+++ b/bin/md5/md5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: md5.c,v 1.83 2015/10/10 20:18:30 deraadt Exp $ */
+/* $OpenBSD: md5.c,v 1.84 2015/12/09 19:36:17 mmcc Exp $ */
/*
* Copyright (c) 2001,2003,2005-2007,2010,2013,2014
@@ -710,8 +710,7 @@ digest_filelist(const char *file, struct hash_function *defhash, int selcount,
fclose(listfp);
if (!found)
warnx("%s: no properly formatted checksum lines found", file);
- if (lbuf != NULL)
- free(lbuf);
+ free(lbuf);
return(error || !found);
}
diff --git a/bin/systrace/filter.c b/bin/systrace/filter.c
index 73e3e8f446f..32dd8b2dc01 100644
--- a/bin/systrace/filter.c
+++ b/bin/systrace/filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.c,v 1.36 2015/04/18 18:28:37 deraadt Exp $ */
+/* $OpenBSD: filter.c,v 1.37 2015/12/09 19:36:17 mmcc Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -216,10 +216,8 @@ logic_free(struct logic *logic)
logic_free(logic->left);
if (logic->right)
logic_free(logic->right);
- if (logic->type)
- free(logic->type);
- if (logic->filterdata)
- free(logic->filterdata);
+ free(logic->type);
+ free(logic->filterdata);
free(logic);
}
@@ -228,8 +226,7 @@ filter_free(struct filter *filter)
{
if (filter->logicroot)
logic_free(filter->logicroot);
- if (filter->rule)
- free(filter->rule);
+ free(filter->rule);
free(filter);
}
diff --git a/bin/systrace/intercept-translate.c b/bin/systrace/intercept-translate.c
index 32d40569b49..60c207cec5c 100644
--- a/bin/systrace/intercept-translate.c
+++ b/bin/systrace/intercept-translate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intercept-translate.c,v 1.17 2014/08/10 04:57:33 guenther Exp $ */
+/* $OpenBSD: intercept-translate.c,v 1.18 2015/12/09 19:36:17 mmcc Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -56,10 +56,8 @@ static int ic_print_sockaddr(char *, size_t, struct intercept_translate *);
static void
ic_trans_free(struct intercept_translate *trans)
{
- if (trans->trans_data)
- free(trans->trans_data);
- if (trans->trans_print)
- free(trans->trans_print);
+ free(trans->trans_data);
+ free(trans->trans_print);
trans->trans_valid = 0;
trans->trans_data = NULL;
trans->trans_print = NULL;
diff --git a/bin/systrace/intercept.c b/bin/systrace/intercept.c
index a06b6f05504..c0bf39a147f 100644
--- a/bin/systrace/intercept.c
+++ b/bin/systrace/intercept.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intercept.c,v 1.64 2015/10/01 02:32:07 guenther Exp $ */
+/* $OpenBSD: intercept.c,v 1.65 2015/12/09 19:36:17 mmcc Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -402,10 +402,8 @@ intercept_freepid(pid_t pidnr)
intercept.freepid(pid);
SPLAY_REMOVE(pidtree, &pids, pid);
- if (pid->name)
- free(pid->name);
- if (pid->newname)
- free(pid->newname);
+ free(pid->name);
+ free(pid->newname);
free(pid);
}
@@ -786,8 +784,7 @@ intercept_syscall(int fd, pid_t pid, u_int16_t seqnr, int policynr,
icpid->execve_code = code;
icpid->policynr = policynr;
- if (icpid->newname)
- free(icpid->newname);
+ free(icpid->newname);
intercept.getarg(0, args, argsize, &addr);
argname = intercept_filename(fd, pid, addr, ICLINK_ALL, before);
@@ -887,15 +884,12 @@ intercept_newimage(int fd, pid_t pid, int policynr,
if (icpid == NULL)
icpid = intercept_getpid(pid);
- if (icpid->name)
- free(icpid->name);
+ free(icpid->name);
if ((icpid->name = strdup(newname)) == NULL)
err(1, "%s:%d: strdup", __func__, __LINE__);
- if (icpid->newname != NULL) {
- free(icpid->newname);
- icpid->newname = NULL;
- }
+ free(icpid->newname);
+ icpid->newname = NULL;
if (intercept_newimagecb != NULL)
(*intercept_newimagecb)(fd, pid, policynr, emulation,
diff --git a/bin/systrace/openbsd-syscalls.c b/bin/systrace/openbsd-syscalls.c
index c0151c41bb0..55934b63aa4 100644
--- a/bin/systrace/openbsd-syscalls.c
+++ b/bin/systrace/openbsd-syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openbsd-syscalls.c,v 1.45 2015/01/16 00:19:12 deraadt Exp $ */
+/* $OpenBSD: openbsd-syscalls.c,v 1.46 2015/12/09 19:36:17 mmcc Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -197,8 +197,7 @@ obsd_getpid(pid_t pid)
static void
obsd_freepid(struct intercept_pid *ipid)
{
- if (ipid->data != NULL)
- free(ipid->data);
+ free(ipid->data);
}
static void