--- a/libpurple/dnsquery.c Tue Jun 01 17:35:17 2021 -0500
+++ b/libpurple/dnsquery.c Tue Jun 01 17:36:18 2021 -0500
@@ -110,12 +110,17 @@
* Callback is a required parameter, but it can get set to
* NULL if we cancel a thread-based DNS lookup. So we need
+ * The host's list is pairs of file descriptors and sockaddr_in's. hosts = g_slist_remove(hosts, hosts->data);
hosts = g_slist_remove(hosts, hosts->data);
@@ -472,8 +477,7 @@
- resolver = g_new(PurpleDnsQueryResolverProcess, 1);
+ resolver = g_new0(PurpleDnsQueryResolverProcess, 1); cope_with_gdb_brokenness();
--- a/libpurple/dnssrv.c Tue Jun 01 17:35:17 2021 -0500
+++ b/libpurple/dnssrv.c Tue Jun 01 17:36:18 2021 -0500
@@ -160,11 +160,15 @@
r = runningtotal ? g_random_int_range(1, runningtotal + 1) : 0;
while (r > ((PurpleSrvResponseContainer *)cur->data)->sum) {
+ if(cur->next == NULL) { /* Set the return parameter and remove cur from the list */
- *container_ptr = cur->data;
+ *container_ptr = cur->data; return g_list_delete_link(list, cur);
@@ -198,9 +202,18 @@
container_list = select_random_response(container_list, &container);
+ if(container == NULL) { cur->data = container->response;
@@ -214,7 +227,7 @@
purple_srv_sort(GList *list)
if (!list || !list->next) {
@@ -228,9 +241,14 @@
PurpleSrvResponse *next_response;
- pref = ((PurpleSrvResponse *)cur->data)->pref;
+ PurpleSrvResponse *resp = (PurpleSrvResponse *)cur->data; next_response = cur->next ? cur->next->data : NULL;
- if (!next_response || next_response->pref != pref) {
+ if (!next_response || next_response->pref != resp->pref) { * The 'count' records starting at 'start' all have the same
* priority. Sort them by weight.
@@ -454,6 +472,8 @@
write_to_parent(in, out, &size, sizeof(size));
write_to_parent(in, out, ret->data, sizeof(PurpleSrvResponse));
if (query.type == T_TXT) {
@@ -463,8 +483,9 @@
write_to_parent(in, out, response->content, l);
ret = g_list_remove(ret, ret->data);