summaryrefslogtreecommitdiff
path: root/bin/systrace
diff options
context:
space:
mode:
Diffstat (limited to 'bin/systrace')
-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
4 files changed, 16 insertions, 28 deletions
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