network: use strdup_or_null() where appropriate

This commit is contained in:
Yu Watanabe 2024-01-19 10:27:14 +09:00
parent 5a02a9adb2
commit 6504d41c63
2 changed files with 3 additions and 3 deletions

View file

@ -615,12 +615,12 @@ int address_dup(const Address *src, Address **ret) {
dest->nft_set_context.n_sets = 0;
if (src->family == AF_INET) {
r = free_and_strdup(&dest->label, src->label);
r = strdup_or_null(src->label, &dest->label);
if (r < 0)
return r;
}
r = free_and_strdup(&dest->netlabel, src->netlabel);
r = strdup_or_null(src->netlabel, &dest->netlabel);
if (r < 0)
return r;

View file

@ -39,7 +39,7 @@ int route_metric_copy(const RouteMetric *src, RouteMetric *dest) {
} else
dest->metrics_set = NULL;
return free_and_strdup(&dest->tcp_congestion_control_algo, src->tcp_congestion_control_algo);
return strdup_or_null(src->tcp_congestion_control_algo, &dest->tcp_congestion_control_algo);
}
void route_metric_hash_func(const RouteMetric *metric, struct siphash *state) {