forked from cory/tildefriends
build: Fix a potential null dereference?
This commit is contained in:
parent
9c0f6481c0
commit
5e23c32ae8
@ -2862,6 +2862,10 @@ static void _tf_ssb_connection_tunnel_callback(
|
|||||||
tf_ssb_connection_t* tf_ssb_connection_tunnel_create(tf_ssb_t* ssb, const char* portal_id, int32_t request_number, const char* target_id, int connect_flags)
|
tf_ssb_connection_t* tf_ssb_connection_tunnel_create(tf_ssb_t* ssb, const char* portal_id, int32_t request_number, const char* target_id, int connect_flags)
|
||||||
{
|
{
|
||||||
tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id);
|
tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id);
|
||||||
|
if (!connection)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
JSContext* context = ssb->context;
|
JSContext* context = ssb->context;
|
||||||
tf_ssb_connection_t* tunnel = tf_malloc(sizeof(tf_ssb_connection_t));
|
tf_ssb_connection_t* tunnel = tf_malloc(sizeof(tf_ssb_connection_t));
|
||||||
@ -4446,8 +4450,7 @@ bool tf_ssb_tunnel_create(tf_ssb_t* ssb, const char* portal_id, const char* targ
|
|||||||
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, request_number, "tunnel.connect", message, NULL, NULL, NULL);
|
tf_ssb_connection_rpc_send_json(connection, k_ssb_rpc_flag_stream | k_ssb_rpc_flag_new_request, request_number, "tunnel.connect", message, NULL, NULL, NULL);
|
||||||
JS_FreeValue(context, message);
|
JS_FreeValue(context, message);
|
||||||
|
|
||||||
tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id, connect_flags);
|
return tf_ssb_connection_tunnel_create(ssb, portal_id, request_number, target_id, connect_flags) != NULL;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user