diff options
Diffstat (limited to 'contrib/ntp/sntp/libevent/test')
-rw-r--r-- | contrib/ntp/sntp/libevent/test/bench_httpclient.c | 4 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/regress.c | 4 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/regress_dns.c | 5 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/regress_http.c | 4 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/regress_minheap.c | 1 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/test-ratelim.c | 4 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/test/test-time.c | 1 |
7 files changed, 21 insertions, 2 deletions
diff --git a/contrib/ntp/sntp/libevent/test/bench_httpclient.c b/contrib/ntp/sntp/libevent/test/bench_httpclient.c index 22f174d..1573e36 100644 --- a/contrib/ntp/sntp/libevent/test/bench_httpclient.c +++ b/contrib/ntp/sntp/libevent/test/bench_httpclient.c @@ -159,6 +159,10 @@ launch_request(void) } ri = malloc(sizeof(*ri)); + if (ri == NULL) { + printf("Unable to allocate memory in launch_request()\n"); + return -1; + } ri->n_read = 0; evutil_gettimeofday(&ri->started, NULL); diff --git a/contrib/ntp/sntp/libevent/test/regress.c b/contrib/ntp/sntp/libevent/test/regress.c index 399ba2f..2d887f0 100644 --- a/contrib/ntp/sntp/libevent/test/regress.c +++ b/contrib/ntp/sntp/libevent/test/regress.c @@ -2823,6 +2823,10 @@ static void * dummy_malloc(size_t len) { char *mem = malloc(len+16); + if (mem == NULL) { + fprintf(stderr, "Unable to allocate memory in dummy_malloc()\n"); + return NULL; + } memcpy(mem, "{[<guardedram>]}", 16); return mem+16; } diff --git a/contrib/ntp/sntp/libevent/test/regress_dns.c b/contrib/ntp/sntp/libevent/test/regress_dns.c index 6d6b484..3181140 100644 --- a/contrib/ntp/sntp/libevent/test/regress_dns.c +++ b/contrib/ntp/sntp/libevent/test/regress_dns.c @@ -1322,7 +1322,7 @@ test_getaddrinfo_async(void *arg) int n_dns_questions = 0; struct evdns_base *dns_base; - memset(a_out, 0, sizeof(a_out)); + memset(&a_out, 0, sizeof(a_out)); memset(&local_outcome, 0, sizeof(local_outcome)); dns_base = evdns_base_new(data->base, 0); @@ -1746,7 +1746,8 @@ end: static void gaic_launch(struct event_base *base, struct evdns_base *dns_base) { - struct gaic_request_status *status = calloc(1,sizeof(*status)); + struct gaic_request_status *status = calloc(1, sizeof(*status)); + tt_assert(status); struct timeval tv = { 0, 10000 }; status->magic = GAIC_MAGIC; status->base = base; diff --git a/contrib/ntp/sntp/libevent/test/regress_http.c b/contrib/ntp/sntp/libevent/test/regress_http.c index 35f6dd7..147f6ff 100644 --- a/contrib/ntp/sntp/libevent/test/regress_http.c +++ b/contrib/ntp/sntp/libevent/test/regress_http.c @@ -367,6 +367,10 @@ http_chunked_cb(struct evhttp_request *req, void *arg) struct timeval when = { 0, 0 }; struct chunk_req_state *state = malloc(sizeof(struct chunk_req_state)); event_debug(("%s: called\n", __func__)); + if (state == NULL) { + fprintf(stderr, "Unable to allocate memory in http_chunked_cb()\n"); + exit(1); + } memset(state, 0, sizeof(struct chunk_req_state)); state->req = req; diff --git a/contrib/ntp/sntp/libevent/test/regress_minheap.c b/contrib/ntp/sntp/libevent/test/regress_minheap.c index 05db32e..24ff293 100644 --- a/contrib/ntp/sntp/libevent/test/regress_minheap.c +++ b/contrib/ntp/sntp/libevent/test/regress_minheap.c @@ -63,6 +63,7 @@ test_heap_randomized(void *ptr) for (i = 0; i < 1024; ++i) { inserted[i] = malloc(sizeof(struct event)); + assert(inserted[i] != NULL); set_random_timeout(inserted[i]); min_heap_push_(&heap, inserted[i]); } diff --git a/contrib/ntp/sntp/libevent/test/test-ratelim.c b/contrib/ntp/sntp/libevent/test/test-ratelim.c index 17babfd..40a1b95 100644 --- a/contrib/ntp/sntp/libevent/test/test-ratelim.c +++ b/contrib/ntp/sntp/libevent/test/test-ratelim.c @@ -340,6 +340,10 @@ test_ratelimiting(void) bevs = calloc(cfg_n_connections, sizeof(struct bufferevent *)); states = calloc(cfg_n_connections, sizeof(struct client_state)); + if (bevs == NULL || states == NULL) { + printf("Unable to allocate memory...\n"); + return 1; + } for (i = 0; i < cfg_n_connections; ++i) { bevs[i] = bufferevent_socket_new(base, -1, diff --git a/contrib/ntp/sntp/libevent/test/test-time.c b/contrib/ntp/sntp/libevent/test/test-time.c index bcc7086..e7dff7d 100644 --- a/contrib/ntp/sntp/libevent/test/test-time.c +++ b/contrib/ntp/sntp/libevent/test/test-time.c @@ -99,6 +99,7 @@ main(int argc, char **argv) for (i = 0; i < NEVENT; i++) { ev[i] = malloc(sizeof(struct event)); + assert(ev[i] != NULL); /* Initalize one event */ evtimer_set(ev[i], time_cb, ev[i]); |