Skip to content

Commit

Permalink
fix invalid use of mutex
Browse files Browse the repository at this point in the history
- Moving a pthread_mutex in memory (e.g. via realloc()) is undefined
  behavior.
- add a state for allocated but not yet used crypto connections
- change crypto_connection_status signature
  • Loading branch information
sudden6 committed Dec 23, 2019
1 parent abfd90d commit 6338cb4
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 89 deletions.
2 changes: 2 additions & 0 deletions toxcore/Messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ int m_get_friend_connectionstatus(const Messenger *m, int32_t friendnumber)
bool direct_connected = 0;
unsigned int num_online_relays = 0;
int crypt_conn_id = friend_connection_crypt_connection_id(m->fr_c, m->friendlist[friendnumber].friendcon_id);

// FIXME(sudden6): handle return value
crypto_connection_status(m->net_crypto, crypt_conn_id, &direct_connected, &num_online_relays);

if (direct_connected) {
Expand Down
Loading

0 comments on commit 6338cb4

Please sign in to comment.