If prepare_bnode fails to allocate memory, it should return null pointers
because callers will try to release allocated memory (ie non-null
pointers).

Signed-off-by: Laurent Riffard <[EMAIL PROTECTED]>
---
 fs/reiser4/plugin/space/bitmap.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

Index: linux-2.6-mm/fs/reiser4/plugin/space/bitmap.c
===================================================================
--- linux-2.6-mm.orig/fs/reiser4/plugin/space/bitmap.c
+++ linux-2.6-mm/fs/reiser4/plugin/space/bitmap.c
@@ -741,9 +741,13 @@ prepare_bnode(struct bitmap_node *bnode,
 
        super = reiser4_get_current_sb();
 
+       /* Callers have to release allocated memory for cjnode an wjnode even
+        * if we return an error code. */
        *wjnode_ret = wjnode = bnew();
-       if (wjnode == NULL)
+       if (wjnode == NULL) {
+               *cjnode_ret = NULL;
                return RETERR(-ENOMEM);
+       }
 
        *cjnode_ret = cjnode = bnew();
        if (cjnode == NULL)

--

Reply via email to