X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftcp_sockets.c;h=70e3cff8cfda9f80c3d5b4213af7d733d083e857;hb=93a9dbcffee25255a50b28cd7bb45a3e86db3378;hp=33889f665ffc998f81037cbd928aa5232c6cc8ad;hpb=da256f9821b31260b7ec2a32eb36778a2ea0a57e;p=citadel.git diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 33889f665..70e3cff8c 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -556,6 +556,7 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, int client_con_state = 0; int chunked = 0; int is_gzip = 0; + const char *Err = NULL; StrBuf *BufHeader = NULL; StrBuf *Buf; StrBuf *pBuf = NULL; @@ -613,7 +614,12 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, if (chunked && !DisableGzip && WCC->Hdr->HR.gzip_ok) { is_gzip = 1; - SC = StrBufNewStreamContext (eZLibEncode); + SC = StrBufNewStreamContext (eZLibEncode, &Err); + if (SC == NULL) { + syslog(LOG_ERR, "Error while initializing stream context: %s", Err); + FreeStrBuf(&Buf); + return; + } memset(&ReadBuffer, 0, sizeof(IOBuffer)); ReadBuffer.Buf = WCC->WBuf; @@ -635,7 +641,9 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, FreeStrBuf(&Buf); FreeStrBuf(&WriteBuffer.Buf); FreeStrBuf(&BufHeader); - StrBufDestroyStreamContext(eZLibEncode, SC); + if (StrBufDestroyStreamContext(eZLibEncode, SC, &Err) && Err) { + syslog(LOG_ERR, "Error while destroying stream context: %s", Err); + } return; } } @@ -650,7 +658,10 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, FreeStrBuf(&Buf); FreeStrBuf(&WriteBuffer.Buf); FreeStrBuf(&BufHeader); - StrBufDestroyStreamContext(eZLibEncode, SC); + StrBufDestroyStreamContext(eZLibEncode, SC, &Err); + if (StrBufDestroyStreamContext(eZLibEncode, SC, &Err) && Err) { + syslog(LOG_ERR, "Error while destroying stream context: %s", Err); + } return; } @@ -684,7 +695,7 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, int rc; do { - rc = StrBufStreamTranscode(eZLibEncode, &WriteBuffer, &ReadBuffer, NULL, -1, SC, done); + rc = StrBufStreamTranscode(eZLibEncode, &WriteBuffer, &ReadBuffer, NULL, -1, SC, done, &Err); if (StrLength (pBuf) > 0) { StrBufPrintf(BufHeader, "%s%x\r\n", @@ -718,7 +729,9 @@ void serv_read_binary_to_http(StrBuf *MimeType, size_t total_len, int is_static, } } - StrBufDestroyStreamContext(eZLibEncode, &SC); + if (SC && StrBufDestroyStreamContext(eZLibEncode, SC, &Err) && Err) { + syslog(LOG_ERR, "Error while destroying stream context: %s", Err); + } FreeStrBuf(&WriteBuffer.Buf); if ((chunked) && (client_con_state == 0)) {