timeserver: Check for resolv before accessing it
authorAlok Barsode <alok.barsode@linux.intel.com>
Thu, 5 Apr 2012 10:20:25 +0000 (13:20 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Thu, 5 Apr 2012 15:57:33 +0000 (18:57 +0300)
In order to cancel any ongoing resolution, check
if both resolv and resolv_id are valid.

src/timeserver.c

index 65b7ad0..e8a9d15 100644 (file)
@@ -262,7 +262,7 @@ static int timeserver_start(struct connman_service *service)
                return -EINVAL;
 
        /* Stop an already ongoing resolution, if there is one */
-       if (resolv_id > 0)
+       if (resolv != NULL && resolv_id > 0)
                g_resolv_cancel_lookup(resolv, resolv_id);
 
        /* get rid of the old resolver */