From: Pekka Enberg <[EMAIL PROTECTED]> We must not overwrite the same pointer that is passed to krealloc() because it can return NULL without freeing the buffer. Fixes a memory leak introduced by me.
Cc: Josef Sipek <[EMAIL PROTECTED]> Signed-off-by: Pekka Enberg <[EMAIL PROTECTED]> --- fs/unionfs/copyup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Index: 2.6/fs/unionfs/copyup.c =================================================================== --- 2.6.orig/fs/unionfs/copyup.c 2007-02-21 14:15:30.000000000 +0200 +++ 2.6/fs/unionfs/copyup.c 2007-02-21 14:16:19.000000000 +0200 @@ -658,11 +658,14 @@ /* grow path table */ if (count == num_dentry) { - path = krealloc(path, kmalloc_size * 2, GFP_KERNEL); - if (!path) { + void *p; + + p = krealloc(path, kmalloc_size * 2, GFP_KERNEL); + if (!p) { hidden_dentry = ERR_PTR(-ENOMEM); goto out; } + path = p; kmalloc_size = ksize(path); num_dentry = kmalloc_size / sizeof(struct dentry *); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/