ssb: Fix a leaked request and a shutdown error.

This commit is contained in:
Cory McWilliams 2024-10-04 12:39:39 -04:00
parent 90e000c18e
commit 7c36a543da

View File

@ -106,6 +106,7 @@ static void _tf_ssb_rpc_blobs_get(tf_ssb_connection_t* connection, uint8_t flags
{
if (flags & k_ssb_rpc_flag_end_error)
{
tf_ssb_connection_remove_request(connection, -request_number);
return;
}
tf_ssb_t* ssb = tf_ssb_connection_get_ssb(connection);
@ -255,6 +256,8 @@ static void _tf_ssb_request_blob_wants_work(tf_ssb_connection_t* connection, voi
static void _tf_ssb_request_blob_wants_after_work(tf_ssb_connection_t* connection, int result, void* user_data)
{
blob_wants_work_t* work = user_data;
if (!tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
{
JSContext* context = tf_ssb_connection_get_context(connection);
tf_ssb_blob_wants_t* blob_wants = tf_ssb_connection_get_blob_wants_state(connection);
for (int i = 0; i < work->out_id_count; i++)
@ -269,6 +272,7 @@ static void _tf_ssb_request_blob_wants_after_work(tf_ssb_connection_t* connectio
{
snprintf(blob_wants->last_id, sizeof(blob_wants->last_id), "%s", work->out_id[work->out_id_count - 1]);
}
}
tf_free(work);
}