mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-08-17 21:25:50 +02:00
- Fix warnings reported by the gcc analyzer.
This commit is contained in:
+4
-1
@@ -347,7 +347,10 @@ static volatile int do_quit = 0;
|
||||
/** signal handler for user quit */
|
||||
static RETSIGTYPE delayer_sigh(int sig)
|
||||
{
|
||||
printf("exit on signal %d\n", sig);
|
||||
char str[] = "exit on signal \n";
|
||||
str[15] = '0' + (sig/10)%10;
|
||||
str[16] = '0' + sig%10;
|
||||
write(STDOUT_FILENO, str, strlen(str));
|
||||
do_quit = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -423,6 +423,7 @@ http2_session_create()
|
||||
|
||||
if(nghttp2_session_callbacks_new(&callbacks) == NGHTTP2_ERR_NOMEM) {
|
||||
log_err("failed to initialize nghttp2 callback");
|
||||
free(h2_session);
|
||||
return NULL;
|
||||
}
|
||||
nghttp2_session_callbacks_set_recv_callback(callbacks, http2_recv_cb);
|
||||
|
||||
@@ -451,6 +451,8 @@ fake_front_query(struct replay_runtime* runtime, struct replay_moment *todo)
|
||||
struct comm_reply repinfo;
|
||||
memset(&repinfo, 0, sizeof(repinfo));
|
||||
repinfo.c = (struct comm_point*)calloc(1, sizeof(struct comm_point));
|
||||
if(!repinfo.c)
|
||||
fatal_exit("out of memory in fake_front_query");
|
||||
repinfo.addrlen = (socklen_t)sizeof(struct sockaddr_in);
|
||||
if(todo->addrlen != 0) {
|
||||
repinfo.addrlen = todo->addrlen;
|
||||
@@ -909,6 +911,8 @@ comm_base_create(int ATTR_UNUSED(sigs))
|
||||
/* we return the runtime structure instead. */
|
||||
struct replay_runtime* runtime = (struct replay_runtime*)
|
||||
calloc(1, sizeof(struct replay_runtime));
|
||||
if(!runtime)
|
||||
fatal_exit("out of memory in fake_event.c:comm_base_create");
|
||||
runtime->scenario = saved_scenario;
|
||||
runtime->vars = macro_store_create();
|
||||
if(!runtime->vars) fatal_exit("out of memory");
|
||||
@@ -1534,6 +1538,8 @@ struct comm_timer* comm_timer_create(struct comm_base* base,
|
||||
{
|
||||
struct replay_runtime* runtime = (struct replay_runtime*)base;
|
||||
struct fake_timer* t = (struct fake_timer*)calloc(1, sizeof(*t));
|
||||
if(!t)
|
||||
fatal_exit("out of memory in fake_event.c:comm_timer_create");
|
||||
t->cb = cb;
|
||||
t->cb_arg = cb_arg;
|
||||
fptr_ok(fptr_whitelist_comm_timer(t->cb)); /* check in advance */
|
||||
|
||||
@@ -397,11 +397,15 @@ send_em(const char* svr, int udp, int usessl, int noanswer, int onarrival,
|
||||
/** SIGPIPE handler */
|
||||
static RETSIGTYPE sigh(int sig)
|
||||
{
|
||||
char str[] = "Got unhandled signal \n";
|
||||
if(sig == SIGPIPE) {
|
||||
printf("got SIGPIPE, remote connection gone\n");
|
||||
char* strpipe = "got SIGPIPE, remote connection gone\n";
|
||||
write(STDOUT_FILENO, strpipe, strlen(strpipe));
|
||||
exit(1);
|
||||
}
|
||||
printf("Got unhandled signal %d\n", sig);
|
||||
str[21] = '0' + (sig/10)%10;
|
||||
str[22] = '0' + sig%10;
|
||||
write(STDOUT_FILENO, str, strlen(str));
|
||||
exit(1);
|
||||
}
|
||||
#endif /* SIGPIPE */
|
||||
|
||||
Reference in New Issue
Block a user