libwebsite
libwebsite copied to clipboard
Leak of repy_body
req->reply_body is not freed for regular http request/responses. Since the consumer of the API doesn't know when the reply completes, this must be handled by libwebsite.
diff --git a/src/core.c b/src/core.c
index a500225..c34723f 100644
--- a/src/core.c
+++ b/src/core.c
@@ -114,6 +114,7 @@ static ws_request_t *ws_request_new(ws_connection_t *conn) {
int ws_request_free(ws_request_t *req) {
obstack_free(&req->pieces, NULL);
+ free(req->reply_body);
free(req);
}
@americandream, in the zerogw which is primary project using libwebsite, reply body is either allocated in obstack or uses a static string or uses zeromq message. First two doesn't need separate "free" call and the latter needs a custom routine for that. You can free the body in callback set by ws_FINISH_CB macro.
I realized that and ended up using ws_FINISH_CB.