kmemleak: do not leak object after tree insertion error
Subsystems (2)
PATCH 1/1 kmemleak: do not leak object after tree insertion error
[PATCH] kmemleak: do not leak object after tree insertion error
In case when tree insertion fails due to already existing object error, pointer to allocated object gets lost due to lookup_object() overwrite. Free allocated object before lookup happens.
Signed-off-by Sergey Senozhatsky <[email protected]>
---
mm/kmemleak.c | 2 ++ 1 file changed, 2 insertions(+)
mm/kmemleak.c +2 -0
@@ -260,6 +260,7 @@ static struct early_logstatic int crt_early_log__initdata ;static void kmemleak_disable (void ); +static void __delete_object (struct kmemleak_object *);/* * Print a warning and dump the stack trace.
@@ -576,6 +577,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,* random memory blocks. */ if (node != &object->tree_node) { +__delete_object (object);kmemleak_stop ("Cannot insert 0x%lx into the object search tree " "(already existing)\n" , ptr); object =lookup_object (ptr,1 );
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>