diff options
| author | Stephen Lord <lord@sgi.com> | 2003-02-19 20:15:53 +0100 |
|---|---|---|
| committer | Christoph Hellwig <hch@lab343.munich.sgi.com> | 2003-02-19 20:15:53 +0100 |
| commit | 2f59a55cc1fefa16875dafe2a2933c5fd2ec27ca (patch) | |
| tree | 89d296e80004952e716c8ff3c88de1ca841bc9f3 | |
| parent | 5906f81916b419a234e628e7f629656fae2e39ff (diff) | |
[XFS] fix a couple of memory leaks found by stanford checker
SGI Modid: 2.5.x-xfs:slinx:138812a
| -rw-r--r-- | fs/xfs/xfs_dir_leaf.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_log_recover.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/fs/xfs/xfs_dir_leaf.c b/fs/xfs/xfs_dir_leaf.c index d689c169f6e7..8dfb1ab6ff2f 100644 --- a/fs/xfs/xfs_dir_leaf.c +++ b/fs/xfs/xfs_dir_leaf.c @@ -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; diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 617eead8f16d..6eddf1a0d591 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -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); |
