From 1b79114d2d828be1a32178673fd5fb297cb437fb Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 30 Apr 2014 22:16:21 +0900 Subject: [PATCH] Fix compiler warnings --- examples/libevent-server.c | 10 +++++++++- lib/nghttp2_hd.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/libevent-server.c b/examples/libevent-server.c index 7303ecf6..1f515d13 100644 --- a/examples/libevent-server.c +++ b/examples/libevent-server.c @@ -383,9 +383,17 @@ static int error_reply(nghttp2_session *session, } return 0; } - write(pipefd[1], ERROR_HTML, sizeof(ERROR_HTML) - 1); + + rv = write(pipefd[1], ERROR_HTML, sizeof(ERROR_HTML) - 1); close(pipefd[1]); + + if(rv != sizeof(ERROR_HTML)) { + close(pipefd[0]); + return -1; + } + stream_data->fd = pipefd[0]; + if(send_response(session, stream_data->stream_id, hdrs, ARRLEN(hdrs), pipefd[0]) != 0) { close(pipefd[0]); diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index 6515c0f7..b5b0ef01 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -1941,7 +1941,7 @@ int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr) *inflater_ptr = malloc(sizeof(nghttp2_hd_inflater)); if(*inflater_ptr == NULL) { - return NULL; + return NGHTTP2_ERR_NOMEM; } return nghttp2_hd_inflate_init(*inflater_ptr);