diff --git a/examples/libevent-client.c b/examples/libevent-client.c index a1994494..598c67e7 100644 --- a/examples/libevent-client.c +++ b/examples/libevent-client.c @@ -425,7 +425,11 @@ static void readcb(struct bufferevent *bev, void *ptr) delete_http2_session_data(session_data); return; } - evbuffer_drain(input, readlen); + if(evbuffer_drain(input, readlen) != 0) { + warnx("Fatal error: evbuffer_drain failed"); + delete_http2_session_data(session_data); + return; + } if(session_send(session_data) != 0) { delete_http2_session_data(session_data); return; diff --git a/examples/libevent-server.c b/examples/libevent-server.c index fce3c409..e5a416c9 100644 --- a/examples/libevent-server.c +++ b/examples/libevent-server.c @@ -250,7 +250,10 @@ static int session_recv(http2_session_data *session_data) warnx("Fatal error: %s", nghttp2_strerror((int)readlen)); return -1; } - evbuffer_drain(input, readlen); + if(evbuffer_drain(input, readlen) != 0) { + warnx("Fatal error: evbuffer_drain failed"); + return -1; + } if(session_send(session_data) != 0) { return -1; }