1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-09 12:58:26 +03:00

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; dest->nft_set_context.n_sets = 0;
if (src->family == AF_INET) { if (src->family == AF_INET) {
r = free_and_strdup(&dest->label, src->label); r = strdup_or_null(src->label, &dest->label);
if (r < 0) if (r < 0)
return r; return r;
} }
r = free_and_strdup(&dest->netlabel, src->netlabel); r = strdup_or_null(src->netlabel, &dest->netlabel);
if (r < 0) if (r < 0)
return r; return r;

View File

@ -39,7 +39,7 @@ int route_metric_copy(const RouteMetric *src, RouteMetric *dest) {
} else } else
dest->metrics_set = NULL; 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) { void route_metric_hash_func(const RouteMetric *metric, struct siphash *state) {