diff options
author | Emmanuel Roullit <emmanuel.roullit@gmail.com> | 2013-04-03 19:07:32 (GMT) |
---|---|---|
committer | Emmanuel Roullit <emmanuel.roullit@gmail.com> | 2013-04-03 19:17:33 (GMT) |
commit | ea436445ad774179d6b3196e102907272f403da8 (patch) | |
tree | 5c093e8089530c36887102b548823d6c6a70f01e | |
parent | 56eb22fa7475843e3f5133dbef5e0e44751dc474 (diff) | |
download | libnl-ea436445ad774179d6b3196e102907272f403da8.zip libnl-ea436445ad774179d6b3196e102907272f403da8.tar.gz libnl-ea436445ad774179d6b3196e102907272f403da8.tar.bz2 |
Perform no operation on nl_object_free(NULL).
Passing a NULL pointer would cause a NULL pointer dereference within
nl_object_free().
Returning early on NULL pointer is the behavior free(3) and other
nl*_free() functions.
Signed-off-by: Emmanuel Roullit <emmanuel.roullit@gmail.com>
-rw-r--r-- | lib/object.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/object.c b/lib/object.c index 17b98f6..b1ebe51 100644 --- a/lib/object.c +++ b/lib/object.c @@ -165,7 +165,12 @@ int nl_object_update(struct nl_object *dst, struct nl_object *src) */ void nl_object_free(struct nl_object *obj) { - struct nl_object_ops *ops = obj_ops(obj); + struct nl_object_ops *ops; + + if (!obj) + return; + + ops = obj_ops(obj); if (obj->ce_refcnt > 0) NL_DBG(1, "Warning: Freeing object in use...\n"); |