libpurple/protocols/bonjour/mdns_common.c

changeset 40329
b5e0f65a5d9c
parent 40137
016690872c6c
child 40331
684befe3ae5d
--- a/libpurple/protocols/bonjour/mdns_common.c	Tue Nov 26 23:59:35 2019 +0300
+++ b/libpurple/protocols/bonjour/mdns_common.c	Wed Nov 27 00:08:11 2019 +0300
@@ -73,9 +73,8 @@
 static inline GSList *
 _add_txt_record(GSList *list, const gchar *key, const gchar *value)
 {
-	PurpleKeyValuePair *kvp = g_new0(PurpleKeyValuePair, 1);
-	kvp->key = g_strdup(key);
-	kvp->value = g_strdup(get_max_txt_record_value(key, value));
+	const char *max_value = get_max_txt_record_value(key, value);
+	PurpleKeyValuePair *kvp = purple_key_value_pair_new(key, g_strdup(max_value));
 	return g_slist_prepend(list, kvp);
 }
 
@@ -143,7 +142,7 @@
 
 	txt_records = generate_presence_txt_records(data);
 	ret = _mdns_publish(data, type, txt_records);
-	g_slist_free_full(txt_records, (GDestroyNotify)purple_key_value_pair_free);
+	g_slist_free_full(txt_records, (GDestroyNotify)purple_key_value_pair_free_full);
 
 	return ret;
 }

mercurial