]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Perform no operation on nl_object_free(NULL).
authorEmmanuel Roullit <emmanuel.roullit@gmail.com>
Wed, 3 Apr 2013 19:07:32 +0000 (21:07 +0200)
committerEmmanuel Roullit <emmanuel.roullit@gmail.com>
Wed, 3 Apr 2013 19:17:33 +0000 (21:17 +0200)
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>
lib/object.c

index 17b98f6b38b54eb00165988cb96520c413335bd2..b1ebe517d3d230ae98bcd7a3d4e7fea0a0b4e099 100644 (file)
@@ -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");