platform: use g_strdup() instead of strdup() in ethtool code

The string is freed with g_free(), it needs to be allocated with
g_strdup(). In practice, the GLib allocator uses malloc() nowadays,
but it is better to be consistent.
This commit is contained in:
Beniamino Galvani
2025-07-04 14:47:31 +02:00
parent 326fb8f9cf
commit 45ab9d96f1

View File

@@ -153,7 +153,7 @@ ethtool_send_and_recv(struct nl_sock *sock,
out:
if (nle < 0 && err_msg && *err_msg == NULL)
*err_msg = strdup(nm_strerror(nle));
*err_msg = g_strdup(nm_strerror(nle));
if (nle >= 0 && cb_result < 0)
nle = cb_result;