summaryrefslogtreecommitdiff
path: root/gweb/gresolv.c
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2013-01-11 14:37:05 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-01-11 15:34:25 +0200
commitc8dd27a205c28d61580c1530d80e510b947e1d2a (patch)
tree7dbf5cc217c103092403dbf969a05b450ff87d63 /gweb/gresolv.c
parentb21b221772b4772ae3e9a885effda233cf79b997 (diff)
downloadconnman-c8dd27a205c28d61580c1530d80e510b947e1d2a.tar.gz
connman-c8dd27a205c28d61580c1530d80e510b947e1d2a.tar.bz2
connman-c8dd27a205c28d61580c1530d80e510b947e1d2a.zip
gweb: Make sure to destroy the lookup before calling any result function
Program received signal SIGSEGV, Segmentation fault. Backtrace: 0 0x00000000004219fe in _debug (resolv=0x75f9a0, file=0x497267 "gweb/gresolv.c", caller=0x497598 "destroy_lookup", format=0x497278 "lookup %p id %d ipv4 %p ipv6 %p") at gweb/gresolv.c:136 1 0x0000000000421ac5 in destroy_lookup (lookup=0x760e40) at gweb/gresolv.c:154 2 0x00000000004224ce in sort_and_return_results (lookup=0x760e40) at gweb/gresolv.c:520 3 0x0000000000422597 in query_timeout (user_data=0x760510) at gweb/gresolv.c:542 4 0x00007ffff7b1b26b in g_timeout_dispatch (source=0x760ea0, callback=<optimized out>, user_data=<optimized out>) at gmain.c:4095 5 0x00007ffff7b1a643 in g_main_dispatch (context=0x6f5110) at gmain.c:2784 6 g_main_context_dispatch (context=0x6f5110) at gmain.c:3288 7 0x00007ffff7b1a988 in g_main_context_iterate (dispatch=1, block=<optimized out>, context=0x6f5110, self=<optimized out>) at gmain.c:3359 8 g_main_context_iterate (context=0x6f5110, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3296 9 0x00007ffff7b1ade5 in g_main_loop_run (loop=0x6f4fe0) at gmain.c:3553 10 0x0000000000442a5f in main (argc=1, argv=0x7fffffffdea8) at src/main.c:705 Reported by Daniel Wagner
Diffstat (limited to 'gweb/gresolv.c')
-rw-r--r--gweb/gresolv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gweb/gresolv.c b/gweb/gresolv.c
index 1f8e372c..322299a7 100644
--- a/gweb/gresolv.c
+++ b/gweb/gresolv.c
@@ -471,6 +471,8 @@ static void sort_and_return_results(struct resolv_lookup *lookup)
char buf[INET6_ADDRSTRLEN + 1];
GResolvResultStatus status;
char **results = g_try_new0(char *, lookup->nr_results + 1);
+ GResolvResultFunc result_func = lookup->result_func;
+ void *result_data = lookup->result_data;
int i, n = 0;
if (!results)
@@ -513,11 +515,11 @@ static void sort_and_return_results(struct resolv_lookup *lookup)
debug(lookup->resolv, "lookup %p received %d results", lookup, n);
g_queue_remove(lookup->resolv->lookup_queue, lookup);
+ destroy_lookup(lookup);
- lookup->result_func(status, results, lookup->result_data);
+ result_func(status, results, result_data);
g_strfreev(results);
- destroy_lookup(lookup);
}
static gboolean query_timeout(gpointer user_data)