diff --git a/demos/http3/ossl-nghttp3-demo-server.c b/demos/http3/ossl-nghttp3-demo-server.c index 2541d78d36..1e89baee12 100644 --- a/demos/http3/ossl-nghttp3-demo-server.c +++ b/demos/http3/ossl-nghttp3-demo-server.c @@ -86,7 +86,10 @@ static void init_ids(struct h3ssl *h3ssl) int i; char *prior_fileprefix = h3ssl->fileprefix; - memset (h3ssl, 0, sizeof (struct h3ssl)); + if (h3ssl->ptr_data != NULL && h3ssl->ptr_data != nulldata) + free(h3ssl->ptr_data); + + memset(h3ssl, 0, sizeof(struct h3ssl)); ssl_ids = h3ssl->ssl_ids; for (i = 0; i < MAXSSL_IDS; i++) { @@ -348,9 +351,15 @@ static int quic_server_read(nghttp3_conn *h3conn, SSL *stream, uint64_t id, stru fprintf(stderr, "SSL_read %d on %llu failed\n", SSL_get_error(stream, ret), (unsigned long long) id); - if (SSL_get_error(stream, ret) == SSL_ERROR_WANT_READ) - return 0; /* retry we need more data */ - ERR_print_errors_fp(stderr); + switch (SSL_get_error(stream, ret)) { + case SSL_ERROR_WANT_READ: + return 0; + case SSL_ERROR_ZERO_RETURN: + return 1; + default: + ERR_print_errors_fp(stderr); + return -1; + } return -1; }