Skip to content

Commit

Permalink
fix minor coverity issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Mauchle committed May 6, 2018
1 parent b29cc4a commit 5223e54
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ void fticks_debug(const char *format, ...) {
else {
priority = LOG_DEBUG | fticks_syslogfacility;
vsyslog(priority, format, ap);
va_end(ap);
}
va_end(ap);
}
/* Local Variables: */
/* c-file-style: "stroustrup" */
Expand Down
3 changes: 2 additions & 1 deletion dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ int getConnectionInfo(int socket, struct sockaddr *from, socklen_t fromlen, stru

debug(DBG_DBG, "udp packet from %s", addr2string(from));

getsockname(socket, to, &tolen);
if (getsockname(socket, to, &tolen))
return -1;
while (offset < msghdr.msg_controllen) {
ctrlhdr = (struct cmsghdr *)(controlbuf+offset);
if(ctrlhdr->cmsg_level == IPPROTO_IP && ctrlhdr->cmsg_type == IP_PKTINFO) {
Expand Down
14 changes: 11 additions & 3 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,22 @@ struct client *addclient(struct clsrvconf *conf, uint8_t lock) {
new = calloc(1, sizeof(struct client));
if (!new) {
debug(DBG_ERR, "malloc failed");
if (lock)
pthread_mutex_unlock(conf->lock);
return NULL;
}
if (!list_push(conf->clients, new)) {
free(new);
if (lock)
pthread_mutex_unlock(conf->lock);
return NULL;
}
new->conf = conf;
if (conf->pdef->addclient)
conf->pdef->addclient(new);
else
new->replyq = newqueue();
pthread_mutex_init(&new->lock, NULL);
list_push(conf->clients, new);
if (lock)
pthread_mutex_unlock(conf->lock);
return new;
Expand Down Expand Up @@ -1231,6 +1238,7 @@ void replylog(struct radmsg *msg, struct server *server, struct request *rq) {
break;
case RSP_MAC_STATIC:
sprintf(logstationid+11, "undisclosed");
break;
case RSP_MAC_ORIGINAL:
default:
strncpy(logstationid+11, (char *)stationid, 128-12);
Expand Down Expand Up @@ -3027,12 +3035,12 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
if (!conf->secret) {
if (!conf->pdef->secretdefault) {
debug(DBG_ERR, "error in block %s, secret must be specified for transport type %s", block, conf->pdef->name);
return 0;
goto errexit;
}
conf->secret = stringcopy(conf->pdef->secretdefault, 0);
if (!conf->secret) {
debug(DBG_ERR, "malloc failed");
return 0;
goto errexit;
}
}

Expand Down
2 changes: 2 additions & 0 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <errno.h>
#include <poll.h>
#include <stdarg.h>
#include <assert.h>
#include "debug.h"
#include "util.h"

Expand Down Expand Up @@ -71,6 +72,7 @@ struct sockaddr *addr_copy(struct sockaddr *in) {
((struct sockaddr_in6 *)out)->sin6_addr = ((struct sockaddr_in6 *)in)->sin6_addr;
break;
}
assert(out);
out->sa_family = in->sa_family;
#ifdef SIN6_LEN
out->sa_len = in->sa_len;
Expand Down

0 comments on commit 5223e54

Please sign in to comment.