Skip to content

use calloc for new_interface_server #14342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions connectivity/lwipstack/lwip/src/core/lwip_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,14 @@ static u16_t dns_txid;
#define LWIP_DNS_ISMDNS_ARG(x)
#endif

/** dns_server_interface structue
used locally for multihoming systems. */
struct dns_server_interface {
char interface_name [INTERFACE_NAME_MAX_SIZE];
ip_addr_t dns_servers[DNS_MAX_SERVERS];
struct dns_server_interface *next;
};

/** DNS query message structure.
No packing needed: only used locally on the stack. */
struct dns_query {
Expand Down Expand Up @@ -433,6 +441,9 @@ dns_add_interface_server(u8_t numdns, const char *interface_name, const ip_addr_
// add new dns server to the list tail
new_interface_server = mem_malloc(sizeof(struct dns_server_interface));
snprintf(new_interface_server->interface_name, INTERFACE_NAME_MAX_SIZE, "%s",interface_name);
for (u32_t i=0; i<DNS_MAX_SERVERS; i++) {
ip_addr_set_zero(&new_interface_server->dns_servers[i]);
}
new_interface_server->dns_servers[numdns] = (*dnsserver);
new_interface_server->next = NULL;

Expand Down
6 changes: 0 additions & 6 deletions connectivity/lwipstack/lwip/src/include/lwip/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
extern "C" {
#endif

struct dns_server_interface {
char interface_name [INTERFACE_NAME_MAX_SIZE];
ip_addr_t dns_servers[DNS_MAX_SERVERS];
struct dns_server_interface *next;
};

/** DNS timer period */
#define DNS_TMR_INTERVAL 1000

Expand Down