]> git.hungrycats.org Git - linux/commitdiff
[XFS] fix a couple of memory leaks found by stanford checker
authorStephen Lord <lord@sgi.com>
Wed, 19 Feb 2003 19:15:53 +0000 (20:15 +0100)
committerChristoph Hellwig <hch@lab343.munich.sgi.com>
Wed, 19 Feb 2003 19:15:53 +0000 (20:15 +0100)
SGI Modid: 2.5.x-xfs:slinx:138812a

fs/xfs/xfs_dir_leaf.c
fs/xfs/xfs_log_recover.c

index d689c169f6e7dde59cd2fb16fa96b2cae703a6a9..8dfb1ab6ff2f7591b7e6c4d1a954d80acb02c894 100644 (file)
@@ -648,7 +648,7 @@ xfs_dir_leaf_to_shortform(xfs_da_args_t *iargs)
        retval = xfs_da_read_buf(iargs->trans, iargs->dp, 0, -1, &bp,
                                               XFS_DATA_FORK);
        if (retval)
-               return(retval);
+               goto out;
        ASSERT(bp != NULL);
        memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount));
        leaf = (xfs_dir_leafblock_t *)tmpbuffer;
index 617eead8f16d76584b0131993695d8e4cabf48c2..6eddf1a0d5918e47820bea378523485b0af80b18 100644 (file)
@@ -1287,10 +1287,6 @@ xlog_recover_add_to_trans(xlog_recover_t *trans,
 
        if (!len)
                return 0;
-       ptr = kmem_zalloc(len, 0);
-       memcpy(ptr, dp, len);
-
-       in_f = (xfs_inode_log_format_t *)ptr;
        item = trans->r_itemq;
        if (item == 0) {
                ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC);
@@ -1299,6 +1295,11 @@ xlog_recover_add_to_trans(xlog_recover_t *trans,
                memcpy(&trans->r_theader, dp, len); /* d, s, l */
                return 0;
        }
+
+       ptr = kmem_alloc(len, 0);
+       memcpy(ptr, dp, len);
+       in_f = (xfs_inode_log_format_t *)ptr;
+
        if (item->ri_prev->ri_total != 0 &&
             item->ri_prev->ri_total == item->ri_prev->ri_cnt) {
                xlog_recover_add_item(&trans->r_itemq);