slab, kmemleak: stop calling kmemleak_erase() unconditionally

When the gotten object is NULL (probably due to ENOMEM), kmemleak_erase() is
unnecessary here, It just sets NULL to where already is NULL.  Add a condition.

Acked-by: Catalin Marinas <[email protected]>
Signed-off-by: J. R. Okajima <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
This commit is contained in:
J. R. Okajima 2009-12-02 16:55:49 +09:00 • committed by Pekka Enberg
commit f3d8b53a3a

View file

@ -3109,7 +3109,8 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)
* per-CPU caches is leaked, we need to make sure kmemleak doesn't
* treat the array pointers as a reference to the object.
*/
kmemleak_erase(&ac->entry[ac->avail]);
if (objp)
kmemleak_erase(&ac->entry[ac->avail]);
return objp;
}