Fix getaddrinfo() handling in blocking resolver
If getaddrinfo() fails, the first call setting the result will already free
the resolver. Trying to access it afterwards will lead to a warning to
the console from glib. getaddrinfo() shouldn't return NULL for the result
list if it returns successful.
--- a/loudmouth/lm-blocking-resolver.c Sat May 11 22:25:15 2019 +0200
+++ b/loudmouth/lm-blocking-resolver.c Sat May 11 22:25:49 2019 +0200
@@ -100,31 +100,10 @@
if (err != 0) {
_lm_resolver_set_result (LM_RESOLVER (resolver), LM_RESOLVER_RESULT_FAILED,
NULL);
-
retval = FALSE;
- }
-
- if (ans == NULL) {
- /* Couldn't find any results */
- g_object_ref (resolver);
- _lm_resolver_set_result (LM_RESOLVER (resolver), LM_RESOLVER_RESULT_FAILED,
- NULL);
-
- g_object_unref (resolver);
- retval = FALSE;
- }
-
- /* FIXME: How to set and iterate the results */
- /*priv->results = ans;
- priv->cur_result = ans; */
-
- if (retval) {
- g_object_ref (resolver);
-
+ } else {
_lm_resolver_set_result (LM_RESOLVER (resolver), LM_RESOLVER_RESULT_OK,
ans);
-
- g_object_unref (resolver);
}
g_free (host);