dns: minor cleanup in update_dns() to use gsize for size

g_strv_length() returns a guint. That is not the right size for the length
of an array. Use the right size.
This commit is contained in:
Thomas Haller 2020-11-17 14:26:47 +01:00
parent 0e7e88cfc7
commit f1564caa15
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1587,7 +1587,6 @@ plugin_skip:;
const char *lladdr = "127.0.0.1";
gboolean need_edns0;
gboolean need_trust;
guint len;
if (NM_IS_DNS_SYSTEMD_RESOLVED(priv->plugin)) {
/* systemd-resolved uses a different link-local address */
@ -1602,8 +1601,10 @@ plugin_skip:;
need_trust = nm_utils_strv_find_first(options, -1, NM_SETTING_DNS_OPTION_TRUST_AD) < 0;
if (need_edns0 || need_trust) {
len = options ? g_strv_length(options) : 0;
options = g_realloc(options, sizeof(char *) * (len + 3));
gsize len;
len = NM_PTRARRAY_LEN(options);
options = g_realloc(options, sizeof(char *) * (len + 3u));
if (need_edns0)
options[len++] = g_strdup(NM_SETTING_DNS_OPTION_EDNS0);
if (need_trust)