forked from cory/tildefriends
Fixed a few more good leaks. Now there are just some unclean shutdown issues.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4803 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -63,6 +63,8 @@ static int _object_to_headers(JSContext* context, JSValue object, const char** h
|
||||
}
|
||||
headers[count * 2 + 0] = JS_ToCString(context, key);
|
||||
headers[count * 2 + 1] = JS_ToCString(context, key_value);
|
||||
JS_FreeValue(context, key);
|
||||
JS_FreeValue(context, key_value);
|
||||
}
|
||||
for (uint32_t i = 0; i < plen; ++i)
|
||||
{
|
||||
@ -315,11 +317,18 @@ static JSValue _httpd_websocket_upgrade(JSContext* context, JSValueConst this_va
|
||||
headers[headers_count * 2 + 1] = key;
|
||||
headers_count++;
|
||||
}
|
||||
headers_count += _object_to_headers(context, argv[1], headers + headers_count * 2, tf_countof(headers) - headers_count * 2);
|
||||
int js_headers_count = _object_to_headers(context, argv[1], headers + headers_count * 2, tf_countof(headers) - headers_count * 2);
|
||||
headers_count += js_headers_count;
|
||||
|
||||
tf_http_request_websocket_upgrade(request);
|
||||
tf_http_respond(request, 101, headers, headers_count, NULL, 0);
|
||||
|
||||
for (int i = headers_count - js_headers_count; i < headers_count * 2; i++)
|
||||
{
|
||||
JS_FreeCString(context, headers[i * 2 + 0]);
|
||||
JS_FreeCString(context, headers[i * 2 + 1]);
|
||||
}
|
||||
|
||||
request->on_message = _httpd_message_callback;
|
||||
request->on_close = _httpd_websocket_close_callback;
|
||||
request->context = context;
|
||||
|
Reference in New Issue
Block a user