Commit 2f59a55c authored by Stephen Lord's avatar Stephen Lord Committed by Christoph Hellwig

[XFS] fix a couple of memory leaks found by stanford checker

SGI Modid: 2.5.x-xfs:slinx:138812a
parent 5906f819
...@@ -648,7 +648,7 @@ xfs_dir_leaf_to_shortform(xfs_da_args_t *iargs) ...@@ -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, retval = xfs_da_read_buf(iargs->trans, iargs->dp, 0, -1, &bp,
XFS_DATA_FORK); XFS_DATA_FORK);
if (retval) if (retval)
return(retval); goto out;
ASSERT(bp != NULL); ASSERT(bp != NULL);
memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount)); memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount));
leaf = (xfs_dir_leafblock_t *)tmpbuffer; leaf = (xfs_dir_leafblock_t *)tmpbuffer;
......
...@@ -1287,10 +1287,6 @@ xlog_recover_add_to_trans(xlog_recover_t *trans, ...@@ -1287,10 +1287,6 @@ xlog_recover_add_to_trans(xlog_recover_t *trans,
if (!len) if (!len)
return 0; return 0;
ptr = kmem_zalloc(len, 0);
memcpy(ptr, dp, len);
in_f = (xfs_inode_log_format_t *)ptr;
item = trans->r_itemq; item = trans->r_itemq;
if (item == 0) { if (item == 0) {
ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC); ASSERT(*(uint *)dp == XFS_TRANS_HEADER_MAGIC);
...@@ -1299,6 +1295,11 @@ xlog_recover_add_to_trans(xlog_recover_t *trans, ...@@ -1299,6 +1295,11 @@ xlog_recover_add_to_trans(xlog_recover_t *trans,
memcpy(&trans->r_theader, dp, len); /* d, s, l */ memcpy(&trans->r_theader, dp, len); /* d, s, l */
return 0; 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 && if (item->ri_prev->ri_total != 0 &&
item->ri_prev->ri_total == item->ri_prev->ri_cnt) { item->ri_prev->ri_total == item->ri_prev->ri_cnt) {
xlog_recover_add_item(&trans->r_itemq); xlog_recover_add_item(&trans->r_itemq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment