Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

CORTX-33741 : Analyze and fix memory leaks for emap module using s3 IOs with valgrind. #2063

Merged
merged 5 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions balloc/ut/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ int test_balloc_ut_ops(struct m0_be_ut_backend *ut_be, struct m0_be_seg *seg,
grp = m0_be_ut_backend_sm_group_lookup(ut_be);
rc = m0_balloc_create(0, seg, grp, &motr_balloc, &M0_FID_INIT(0, 1));
M0_UT_ASSERT(rc == 0);
motr_balloc->cb_ballroom.ab_ops->bo_fini(&motr_balloc->cb_ballroom);

rc = motr_balloc->cb_ballroom.ab_ops->bo_init
(&motr_balloc->cb_ballroom, seg, BALLOC_DEF_BLOCK_SHIFT,
Expand Down
10 changes: 7 additions & 3 deletions be/extmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,9 @@ static int emap_it_open(struct m0_be_emap_cursor *it, int prev_rc)
ext->ee_val = rec->er_value;
ext->ee_cksum_buf.b_nob = rec->er_cksum_nob;
ext->ee_cksum_buf.b_addr = rec->er_cksum_nob ?
(void *)&rec->er_footer : NULL;
(void *)&rec->er_footer : NULL;
it->ec_unit_size = rec->er_unit_size;
if (!emap_it_prefix_ok(it))
if (!emap_it_prefix_ok(it))
rc = -ESRCH;
}
it->ec_op.bo_u.u_emap.e_rc = rc;
Expand All @@ -1254,7 +1254,7 @@ static void emap_it_init(struct m0_be_emap_cursor *it,
static void be_emap_close(struct m0_be_emap_cursor *it)
{
if (it->ec_recbuf.b_addr != NULL ) {
m0_buf_free(&it->ec_recbuf);
m0_buf_free(&it->ec_recbuf);
}

m0_btree_cursor_fini(&it->ec_cursor);
Expand Down Expand Up @@ -1537,6 +1537,10 @@ be_emap_split(struct m0_be_emap_cursor *it,
rc = emap_it_get(it);

it->ec_op.bo_u.u_emap.e_rc = rc;
if (it->ec_recbuf.b_addr != NULL) {
m0_buf_free(&it->ec_recbuf);
it->ec_recbuf.b_addr = NULL;
}
return M0_RC(rc);
}

Expand Down
1 change: 1 addition & 0 deletions stob/ad.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ static int stob_ad_domain_create(struct m0_stob_type *type,
*/
rc = m0_balloc_create(dom_key, seg, grp, &cb,
&cfg->adg_id.si_fid);
cb->cb_ballroom.ab_ops->bo_fini(&cb->cb_ballroom);
rc = rc ?: m0_be_tx_exclusive_open_sync(&tx);

M0_ASSERT(adom == NULL);
Expand Down