examples/libevent-client.c: Fix memory leak, use nghttp2_session_fail_session

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-25 00:29:36 +09:00
parent f8356dd037
commit 286345a2ef
1 changed files with 2 additions and 2 deletions

View File

@ -146,6 +146,7 @@ static void delete_http2_session_data(http2_session_data *session_data)
delete_http2_stream_data(session_data->stream_data); delete_http2_stream_data(session_data->stream_data);
session_data->stream_data = NULL; session_data->stream_data = NULL;
} }
free(session_data);
} }
/* Print HTTP headers to |f|. Please note that this function does not /* Print HTTP headers to |f|. Please note that this function does not
@ -249,8 +250,7 @@ static int on_stream_close_callback(nghttp2_session *session,
if(session_data->stream_data->stream_id == stream_id) { if(session_data->stream_data->stream_id == stream_id) {
fprintf(stderr, "Stream %d closed with error_code=%d\n", fprintf(stderr, "Stream %d closed with error_code=%d\n",
stream_id, error_code); stream_id, error_code);
rv = nghttp2_submit_goaway(session, NGHTTP2_FLAG_NONE, NGHTTP2_NO_ERROR, rv = nghttp2_session_fail_session(session, NGHTTP2_NO_ERROR);
NULL, 0);
if(rv != 0) { if(rv != 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE; return NGHTTP2_ERR_CALLBACK_FAILURE;
} }