From 1783826856e13d5234e5968720adb36f1464c845 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 4 Feb 2016 16:42:00 +0100 Subject: [PATCH] cli: sort_access_points() doesn't take a NULL argument The device never returns NULL access point list, it only deallocates it on dispose(). Make this clear for Coverity: CID 59387 (#1 of 1): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking aps suggests that it may be null, but it has already been dereferenced on all paths leading to the check. --- clients/cli/devices.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clients/cli/devices.c b/clients/cli/devices.c index c1df7fee49..1b221a88e2 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -587,8 +587,10 @@ sort_access_points (const GPtrArray *aps) GPtrArray *sorted; int i; + g_return_val_if_fail (aps, NULL); + sorted = g_ptr_array_sized_new (aps->len); - for (i = 0; aps && i < aps->len; i++) + for (i = 0; i < aps->len; i++) g_ptr_array_add (sorted, aps->pdata[i]); g_ptr_array_sort_with_data (sorted, compare_aps, NULL); return sorted;