chiark / gitweb /
sd-resolve: make sure we can destroy a query object from its own callback handler
authorLennart Poettering <lennart@poettering.net>
Mon, 5 May 2014 21:49:19 +0000 (23:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 5 May 2014 21:49:19 +0000 (23:49 +0200)
src/libsystemd/sd-resolve/sd-resolve.c

index cb8e34e..3f699ce 100644 (file)
@@ -737,7 +737,7 @@ static int complete_query(sd_resolve *resolve, sd_resolve_query *q) {
         q->done = true;
         resolve->n_done ++;
 
-        resolve->current = q;
+        resolve->current = sd_resolve_query_ref(q);
 
         switch (q->type) {
 
@@ -758,7 +758,7 @@ static int complete_query(sd_resolve *resolve, sd_resolve_query *q) {
                 assert_not_reached("Cannot complete unknown query type");
         }
 
-        resolve->current = NULL;
+        resolve->current = sd_resolve_query_unref(q);
 
         return r;
 }