Browse Source

nfqws: do not realloc hostname in ipcache if it's the same

pull/1464/head
bol-van 3 months ago
parent
commit
603265dac2
  1. 3
      nfq/desync.c

3
nfq/desync.c

@ -810,6 +810,8 @@ static bool ipcache_put_hostname(const struct in_addr *a4, const struct in6_addr
DLOG_ERR("ipcache_put_hostname: out of memory\n"); DLOG_ERR("ipcache_put_hostname: out of memory\n");
return false; return false;
} }
if (!ipc->hostname || strcmp(ipc->hostname,hostname))
{
free(ipc->hostname); free(ipc->hostname);
if (!(ipc->hostname = strdup(hostname))) if (!(ipc->hostname = strdup(hostname)))
{ {
@ -817,6 +819,7 @@ static bool ipcache_put_hostname(const struct in_addr *a4, const struct in6_addr
return false; return false;
} }
DLOG("hostname cached: %s\n", hostname); DLOG("hostname cached: %s\n", hostname);
}
return true; return true;
} }
static bool ipcache_get_hostname(const struct in_addr *a4, const struct in6_addr *a6, char *hostname, size_t hostname_buf_len) static bool ipcache_get_hostname(const struct in_addr *a4, const struct in6_addr *a6, char *hostname, size_t hostname_buf_len)

Loading…
Cancel
Save