etcp_send: fix contract (caller owns entry on error) + fix 7 leak sites
This commit is contained in:
1 parent
fae0a7c069
commit
16237b0df8
7 files changed
+37
-21
No files matched your search
@@ -286,14 +286,17 @@ static void route_ping_series_finish(struct route_ping_series_ctx* ctx) {
|
||||
if (e) {
|
||||
e->dgram = (uint8_t*)resp;
|
||||
e->len = sizeof(struct NATDET_PING_RESP);
|
||||
etcp_send(ctx->reply_conn, e);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP,
|
||||
"PING series done %s request_id=%08x sent=%u ok=%u avg_rtt=%u",
|
||||
ctx->reply_conn->log_name,
|
||||
(unsigned)ctx->request_id,
|
||||
(unsigned)ctx->count_sent,
|
||||
(unsigned)ctx->count_ok,
|
||||
(unsigned)avg_rtt);
|
||||
if (etcp_send(ctx->reply_conn, e) != 0) {
|
||||
queue_dgram_free(e); queue_entry_free(e);
|
||||
} else {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_BGP,
|
||||
"PING series done %s request_id=%08x sent=%u ok=%u avg_rtt=%u",
|
||||
ctx->reply_conn->log_name,
|
||||
(unsigned)ctx->request_id,
|
||||
(unsigned)ctx->count_sent,
|
||||
(unsigned)ctx->count_ok,
|
||||
(unsigned)avg_rtt);
|
||||
}
|
||||
} else {
|
||||
u_free(resp);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ static void tgi_handle_info_req(struct ETCP_CONN* conn, const uint8_t* data, siz
|
||||
if (sg) memcpy(resp->ed25519_pubkey, sg->ed25519_public_key, SC_PUBKEY_SIZE);
|
||||
resp->node_name_len = (uint8_t)nl; if (nl) memcpy(resp->node_name, nm, nl);
|
||||
struct ll_entry* qe = queue_entry_new(0);
|
||||
if (qe) { qe->dgram = rb; qe->len = (uint16_t)rs; etcp_send(conn, qe); } else u_free(rb);
|
||||
if (qe) { qe->dgram = rb; qe->len = (uint16_t)rs;
|
||||
if (etcp_send(conn, qe) != 0) { queue_dgram_free(qe); queue_entry_free(qe); } } else u_free(rb);
|
||||
DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "invite: group=%016llx NOT in DB — responding is_member=NO to 0x%016llx",
|
||||
(unsigned long long)req->group_id, (unsigned long long)conn->peer_node_id);
|
||||
return;
|
||||
@@ -226,7 +227,8 @@ static void tgi_handle_info_req(struct ETCP_CONN* conn, const uint8_t* data, siz
|
||||
(int)ch_nl, ch_name, (unsigned long long)owner, (unsigned)inv_flags, rs);
|
||||
|
||||
{ struct ll_entry* qe = queue_entry_new(0);
|
||||
if (qe) { qe->dgram = rb; qe->len = (uint16_t)rs; etcp_send(conn, qe); } else u_free(rb);
|
||||
if (qe) { qe->dgram = rb; qe->len = (uint16_t)rs;
|
||||
if (etcp_send(conn, qe) != 0) { queue_dgram_free(qe); queue_entry_free(qe); } } else u_free(rb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user