network: make address_free() return NULL

This commit is contained in:
Yu Watanabe 2020-10-02 12:18:37 +09:00
parent 2488e4d934
commit 7818f8589a
2 changed files with 4 additions and 4 deletions

View file

@ -110,9 +110,9 @@ static int address_new_static(Network *network, const char *filename, unsigned s
return 0;
}
void address_free(Address *address) {
Address *address_free(Address *address) {
if (!address)
return;
return NULL;
if (address->network) {
LIST_REMOVE(addresses, address->network->static_addresses, address);
@ -149,7 +149,7 @@ void address_free(Address *address) {
network_config_section_free(address->section);
free(address->label);
free(address);
return mfree(address);
}
static uint32_t address_prefix(const Address *a) {

View file

@ -57,7 +57,7 @@ struct Address {
};
int address_new(Address **ret);
void address_free(Address *address);
Address *address_free(Address *address);
int address_add_foreign(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
int address_add(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);
int address_get(Link *link, int family, const union in_addr_union *in_addr, unsigned char prefixlen, Address **ret);