aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/fwcontrol/fwcontrol.c3
-rw-r--r--usr.sbin/newsyslog/newsyslog.c3
-rw-r--r--usr.sbin/ypserv/yp_main.c7
3 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c
index 6aa365a3a61c..b8aeb5b10081 100644
--- a/usr.sbin/fwcontrol/fwcontrol.c
+++ b/usr.sbin/fwcontrol/fwcontrol.c
@@ -152,8 +152,7 @@ str2node(int fd, const char *nodestr)
fweui2eui64(&data->dev[i].eui, &tmpeui);
if (memcmp(&eui, &tmpeui, sizeof(struct eui64)) == 0) {
node = data->dev[i].dst;
- if (data != NULL)
- free(data);
+ free(data);
goto gotnode;
}
}
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index 191f077f6b39..0a0212e8a1dc 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -1946,9 +1946,10 @@ do_zipwork(struct zipwork_entry *zwork)
char zresult[MAXPATHLEN];
int c;
+ assert(zwork != NULL);
pgm_path = NULL;
strlcpy(zresult, zwork->zw_fname, sizeof(zresult));
- if (zwork != NULL && zwork->zw_conf != NULL &&
+ if (zwork->zw_conf != NULL &&
zwork->zw_conf->compress > COMPRESS_NONE)
for (c = 1; c < COMPRESS_TYPES; c++) {
if (zwork->zw_conf->compress == c) {
diff --git a/usr.sbin/ypserv/yp_main.c b/usr.sbin/ypserv/yp_main.c
index 7473e6fc4396..6da1ea58d8e8 100644
--- a/usr.sbin/ypserv/yp_main.c
+++ b/usr.sbin/ypserv/yp_main.c
@@ -256,6 +256,7 @@ create_service(const int sock, const struct netconfig *nconf,
const struct __rpc_sockinfo *si)
{
int error;
+ char *sname;
SVCXPRT *transp;
struct addrinfo hints, *res, *res0;
@@ -263,6 +264,7 @@ create_service(const int sock, const struct netconfig *nconf,
struct bindaddrlistent *blep;
struct netbuf svcaddr;
+ sname = NULL;
SLIST_INIT(&sle_head);
memset(&hints, 0, sizeof(hints));
memset(&svcaddr, 0, sizeof(svcaddr));
@@ -342,7 +344,6 @@ create_service(const int sock, const struct netconfig *nconf,
if (strncmp("0", servname, 1) == 0) {
struct sockaddr *sap;
socklen_t slen;
- char *sname;
sname = malloc(NI_MAXSERV);
if (sname == NULL) {
@@ -362,6 +363,7 @@ create_service(const int sock, const struct netconfig *nconf,
strerror(errno));
freeaddrinfo(res0);
close(s);
+ free(sname);
return -1;
}
error = getnameinfo(sap, slen,
@@ -373,6 +375,7 @@ create_service(const int sock, const struct netconfig *nconf,
strerror(errno));
freeaddrinfo(res0);
close(s);
+ free(sname);
return -1;
}
servname = sname;
@@ -441,7 +444,7 @@ create_service(const int sock, const struct netconfig *nconf,
}
/* XXX: ignore error intentionally */
rpcb_set(YPPROG, YPVERS, nconf, &svcaddr);
-
+ free (sname);
freeaddrinfo(res0);
return 0;
}