mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Call freeaddrinfo on error paths in net_getipport.
Without these, we'll have a memory leak on error paths.
This commit is contained in:
parent
6c523f9f48
commit
79d8a22b48
|
@ -1273,12 +1273,14 @@ int32_t net_getipport(const char *node, IP_Port **res, int tox_type)
|
|||
assert(count <= MAX_COUNT);
|
||||
|
||||
if (count == 0) {
|
||||
freeaddrinfo(infos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
*res = (IP_Port *)malloc(sizeof(IP_Port) * count);
|
||||
|
||||
if (*res == NULL) {
|
||||
freeaddrinfo(infos);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user