if(verbosity) log_info("bidirectional stream");
if(!reply_with_accept(data)) {
tap_data_free(data);
+ return;
}
} else if(data->len >= 4 && sldns_read_uint32(data->frame) ==
FSTRM_CONTROL_FRAME_STOP && data->is_bidirectional) {
/** signal handler for user quit */
static RETSIGTYPE main_sigh(int sig)
{
- if(!sig_quit)
- fprintf(stderr, "exit on signal %d\n", sig);
+ if(!sig_quit) {
+ char str[] = "exit on signal \n";
+ str[15] = '0' + (sig/10)%10;
+ str[16] = '0' + sig%10;
+ write(STDERR_FILENO, str, strlen(str));
+ }
if(sig_base) {
ub_event_base_loopexit(sig_base);
sig_base = NULL;
23 June 2021: Wouter
- Fix #503: DNS over HTTPS response truncated.
+ - Fix warnings reported by the gcc analyzer.
21 June 2021: George
- Fix #495: Documentation or implementation of "verbosity" option.
if(rep->rrset_count != 0)
res->ttl = (int)rep->ttl;
res->data = (char**)calloc(1, sizeof(char*));
+ if(!res->data)
+ return 0; /* out of memory */
res->len = (int*)calloc(1, sizeof(int));
- return (res->data && res->len);
+ if(!res->len) {
+ free(res->data);
+ res->data = NULL;
+ return 0; /* out of memory */
+ }
+ return 1;
}
data = (struct packed_rrset_data*)answer->entry.data;
if(query_dname_compare(rq->qname, answer->rk.dname) != 0) {
return 0; /* out of memory */
} else res->canonname = NULL;
res->data = (char**)calloc(data->count+1, sizeof(char*));
+ if(!res->data)
+ return 0; /* out of memory */
res->len = (int*)calloc(data->count+1, sizeof(int));
- if(!res->data || !res->len)
+ if(!res->len) {
+ free(res->data);
+ res->data = NULL;
return 0; /* out of memory */
+ }
for(i=0; i<data->count; i++) {
/* remove rdlength from rdata */
res->len[i] = (int)(data->rr_len[i] - 2);
res->data[i] = memdup(data->rr_data[i]+2, (size_t)res->len[i]);
- if(!res->data[i])
+ if(!res->data[i]) {
+ size_t j;
+ for(j=0; j<i; j++) {
+ free(res->data[j]);
+ res->data[j] = NULL;
+ }
+ free(res->data);
+ res->data = NULL;
+ free(res->len);
+ res->len = NULL;
return 0; /* out of memory */
+ }
}
/* ttl for positive answers, from CNAME and answer RRs */
if(data->count != 0) {
int r;
struct cb_data* id;
id = (struct cb_data*) malloc(sizeof(struct cb_data));
+ if(!id)
+ return -2; /* UB_NOMEM */
id->data = mydata;
id->func = pyfunc;
/** 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;
}
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);
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;
/* 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");
{
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 */
/** 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 */