From e8588d0c6fe900ad60664c68aca4fa793b50e51b Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Thu, 3 Oct 2019 17:02:07 +0500 Subject: [PATCH] src/devices/nm-device.c: resolve possible null pointer dereference found by cppcheck [src/devices/nm-device.c:3032] -> [src/devices/nm-device.c:3025]: (warning) Either the condition '!handle' is redundant or there is possible null pointer dereference: handle. https://github.com/NetworkManager/NetworkManager/pull/352 --- src/devices/nm-device.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index bd6a84ee0e..76cd317eaf 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3021,15 +3021,15 @@ concheck_cb (NMConnectivity *connectivity, self_keep_alive = g_object_ref (self); + /* keep @self alive, while we invoke callbacks. */ + priv = NM_DEVICE_GET_PRIVATE (self); + _LOGT (LOGD_CONCHECK, "connectivity: [Ipv%c] complete check (seq:%llu, state:%s)", nm_utils_addr_family_to_char (handle->addr_family), (long long unsigned) handle->seq, nm_connectivity_state_to_string (state)); - /* keep @self alive, while we invoke callbacks. */ - priv = NM_DEVICE_GET_PRIVATE (self); - - nm_assert (!handle || c_list_contains (&priv->concheck_lst_head, &handle->concheck_lst)); + nm_assert (handle && c_list_contains (&priv->concheck_lst_head, &handle->concheck_lst)); seq = handle->seq;