Skip to content

Commit

Permalink
Don't copy sock address if it points to the same memory (pjsip#2795)
Browse files Browse the repository at this point in the history
  • Loading branch information
trengginas authored Aug 18, 2021
1 parent 15663e3 commit 6775bdc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pjlib/src/pj/sock_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,10 @@ PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
}

if (j == cand_cnt) {
pj_sockaddr_copy_addr(&cand_addr[cand_cnt],
&cand_addr[start_if+i]);
if (cand_cnt != (start_if + i)) {
pj_sockaddr_copy_addr(&cand_addr[cand_cnt],
&cand_addr[start_if + i]);
}
cand_weight[cand_cnt] += WEIGHT_INTERFACE;
++cand_cnt;
}
Expand Down

0 comments on commit 6775bdc

Please sign in to comment.