NULL);
t = evtimer_new(data->base, timeout_cb, NULL);
+ tt_assert(r);
+ tt_assert(w);
+ tt_assert(t);
+
evutil_gettimeofday(&now, NULL);
event_add(r, NULL);
event_add(t, &tv);
unsigned int i;
struct evbuffer * buf = evbuffer_new();
+ tt_assert(buf);
+
/* make sure evbuffer_find doesn't match past the end of the buffer */
evbuffer_add(buf, (u_char*)test1, strlen(test1));
evbuffer_validate(buf);
struct evbuffer_ptr pos;
struct evbuffer_iovec v[1];
+ tt_assert(buf);
+
/* create some chains */
evbuffer_reserve_space(buf, 5000, v, 1);
v[0].iov_len = 5000;
struct evbuffer *tmp = evbuffer_new();
struct evbuffer_ptr pos, end;
+ tt_assert(buf);
+ tt_assert(tmp);
+
/* set up our chains */
evbuffer_add_printf(tmp, "hello"); /* 5 chars */
evbuffer_add_buffer(buf, tmp);
struct evbuffer *buf_out2 = evbuffer_new();
struct evbuffer_cb_entry *cb1, *cb2;
+ tt_assert(buf);
+ tt_assert(buf_out1);
+ tt_assert(buf_out2);
+
cb1 = evbuffer_add_cb(buf, log_change_callback, buf_out1);
cb2 = evbuffer_add_cb(buf, log_change_callback, buf_out2);
&n_accept,
LEV_OPT_REUSEABLE|LEV_OPT_CLOSE_ON_EXEC,
-1, (struct sockaddr *)&sin, sizeof(sin));
+ tt_assert(listener);
listener_port = regress_get_socket_port(
evconnlistener_get_fd(listener));
int n_dns_questions = 0;
struct evdns_base *dns_base = evdns_base_new(data->base, 0);
+ tt_assert(dns_base);
/* for localhost */
evdns_base_load_hosts(dns_base, NULL);
{
int ok = 0;
struct testleak_env_t *env = env_;
+ tt_assert(env);
#ifdef _EVENT_DISABLE_DEBUG_MODE
tt_int_op(allocated_chunks, ==, 0);
#else
#endif
ok = 1;
end:
- if (env->dns_base)
- evdns_base_free(env->dns_base, 0);
- if (env->base)
- event_base_free(env->base);
- if (env)
+ if (env) {
+ if (env->dns_base)
+ evdns_base_free(env->dns_base, 0);
+ if (env->base)
+ event_base_free(env->base);
free(env);
+ }
return ok;
}
/* try mixing edge-triggered and level-triggered to make sure it fails*/
ev_et = event_new(base, data->pair[0], EV_READ|EV_ET, read_cb, ev_et);
+ tt_assert(ev_et);
ev_lt = event_new(base, data->pair[0], EV_READ, read_cb, ev_lt);
+ tt_assert(ev_lt);
/* Add edge-triggered, then level-triggered. Get an error. */
tt_int_op(0, ==, event_add(ev_et, NULL));
http_primitives(void *ptr)
{
char *escaped = NULL;
- struct evhttp *http;
+ struct evhttp *http = NULL;
escaped = evhttp_htmlescape("<script>");
+ tt_assert(escaped);
tt_str_op(escaped, ==, "<script>");
free(escaped);
escaped = evhttp_htmlescape("\"\'&");
+ tt_assert(escaped);
tt_str_op(escaped, ==, ""'&");
http = evhttp_new(NULL);
+ tt_assert(http);
tt_int_op(evhttp_set_cb(http, "/test", http_basic_cb, NULL), ==, 0);
tt_int_op(evhttp_set_cb(http, "/test", http_basic_cb, NULL), ==, -1);
tt_int_op(evhttp_del_cb(http, "/test"), ==, 0);
tt_int_op(evhttp_del_cb(http, "/test"), ==, -1);
tt_int_op(evhttp_set_cb(http, "/test", http_basic_cb, NULL), ==, 0);
- evhttp_free(http);
end:
if (escaped)
free(escaped);
+ if (http)
+ evhttp_free(http);
}
static void
int i;
msg = msg_new();
+
+ tt_assert(msg);
+
EVTAG_ASSIGN(msg, from_name, "niels");
EVTAG_ASSIGN(msg, to_name, "phoenix");