Commit 22f130ca authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix resource leak in ssjs_send_headers()

IdArray returned by JS_Enumerate() was never freed.

Caught by Coverity-scan, CID 319627.
parent 7505f317
Pipeline #1817 passed with stage
in 16 minutes and 35 seconds
......@@ -5805,6 +5805,7 @@ static BOOL ssjs_send_headers(http_session_t* session,int chunked)
if(p==NULL) {
if(p2)
free(p2);
JS_DestroyIdArray(session->js_cx, heads);
return FALSE;
}
if(JS_GetProperty(session->js_cx,headers,p,&val))
......@@ -5814,6 +5815,7 @@ static BOOL ssjs_send_headers(http_session_t* session,int chunked)
free(p);
if(p2)
free(p2);
JS_DestroyIdArray(session->js_cx, heads);
return FALSE;
}
if (p2 != NULL && !session->req.sent_headers) {
......@@ -5853,6 +5855,7 @@ static BOOL ssjs_send_headers(http_session_t* session,int chunked)
if(p2)
free(p2);
JS_ClearScope(session->js_cx, headers);
JS_DestroyIdArray(session->js_cx, heads);
}
JS_ENDREQUEST(session->js_cx);
return(send_headers(session,session->req.status,chunked));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment