mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 12:39:01 -04:00
Remove memleak from Python httpclient.
We grab a reference to the pyhttp_client for the client_op data structure but never removed it. This caused the pyhttp_client object to never be released when out of scope.
This commit is contained in:
parent
a4d18ca276
commit
93b1d621d7
@ -675,6 +675,7 @@ struct pyhttp_client_op {
|
||||
int headers;
|
||||
struct kore_curl curl;
|
||||
struct python_coro *coro;
|
||||
struct pyhttp_client *client;
|
||||
};
|
||||
|
||||
static PyObject *pyhttp_client_op_await(PyObject *);
|
||||
|
@ -4228,6 +4228,7 @@ pyhttp_client_request(struct pyhttp_client *client, int m, PyObject *kwargs)
|
||||
op->state = PYHTTP_CLIENT_OP_RUN;
|
||||
|
||||
Py_INCREF(client);
|
||||
op->client = client;
|
||||
|
||||
kore_curl_http_setup(&op->curl, m, ptr, length);
|
||||
kore_curl_bind_callback(&op->curl, python_curl_callback, op);
|
||||
@ -4302,6 +4303,7 @@ pyhttp_client_request(struct pyhttp_client *client, int m, PyObject *kwargs)
|
||||
static void
|
||||
pyhttp_client_op_dealloc(struct pyhttp_client_op *op)
|
||||
{
|
||||
Py_DECREF(op->client);
|
||||
kore_curl_cleanup(&op->curl);
|
||||
PyObject_Del((PyObject *)op);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user