Fix derefrencing of NULL pointer 22/249822/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 11 Nov 2020 11:12:49 +0000 (20:12 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Thu, 17 Dec 2020 02:16:56 +0000 (11:16 +0900)
In some cases network->device could be NULL which leads to crash

Change-Id: I14210822179f0d8ecbc8bcd046700d1118409cbd
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/service.c

index 90ff7e5..6c4dbd1 100755 (executable)
@@ -7618,6 +7618,9 @@ static int calculate_score_last_user_selection(struct connman_service *service)
        struct tm* ref_timeinfo;
 
        device = connman_network_get_device(service->network);
+       if (!device)
+               return 0;
+
        last_user_selection_time = connman_device_get_last_user_selection_time(device);
        last_user_selection_ident = connman_device_get_last_user_selection_ident(device);
        frequency = connman_network_get_frequency(service->network);