summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-27 16:54:43 +0100
committerThomas Haller <thaller@redhat.com>2019-03-13 09:03:59 +0100
commit2c37a3fb1ed4faccf60f06b81b1ca2a7f4fa6f5e (patch)
tree94f7d13cf88b7cb0a4074eee23180b1fdff6c8e6
parentac4a1deba02708e7538bd6fbf1c88c7245342ae2 (diff)
downloadNetworkManager-2c37a3fb1ed4faccf60f06b81b1ca2a7f4fa6f5e.tar.gz
platform: add NULL check in inline nmp_object_unref() function
This allows the compiler to see that this function does nothing for %NULL. That is not so unusual, as we use nm_auto_nmpobj to free objects. Often the compiler can see that these pointers are %NULL.
-rw-r--r--src/platform/nmp-object.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/platform/nmp-object.h b/src/platform/nmp-object.h
index 7d64b094ce..5c5b510ad0 100644
--- a/src/platform/nmp-object.h
+++ b/src/platform/nmp-object.h
@@ -632,9 +632,11 @@ nmp_object_ref (const NMPObject *obj)
static inline void
nmp_object_unref (const NMPObject *obj)
{
- nm_assert (!obj || NMP_OBJECT_IS_VALID (obj));
+ if (obj) {
+ nm_assert (NMP_OBJECT_IS_VALID (obj));
- nm_dedup_multi_obj_unref ((const NMDedupMultiObj *) obj);
+ nm_dedup_multi_obj_unref ((const NMDedupMultiObj *) obj);
+ }
}
#define nm_clear_nmp_object(ptr) \