Skip to content

Commit bffcb2c

Browse files
committed
rgw/rgw_rados.cc: close resource leak in error case
Fix for: CID 1297867 (#1 of 1): Resource leak (RESOURCE_LEAK) alloc_arg: put_obj_init allocates memory that is stored into out_stream_req. leaked_storage: Variable out_stream_req going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
1 parent b43497c commit bffcb2c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/rgw/rgw_rados.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4122,8 +4122,10 @@ int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate,
41224122
RGWRESTStreamWriteRequest *out_stream_req;
41234123

41244124
int ret = rest_master_conn->put_obj_init(user_id, dest_obj, astate->size, src_attrs, &out_stream_req);
4125-
if (ret < 0)
4125+
if (ret < 0) {
4126+
delete out_stream_req;
41264127
return ret;
4128+
}
41274129

41284130
ret = read_op.iterate(0, astate->size - 1, out_stream_req->get_out_cb());
41294131
if (ret < 0)

0 commit comments

Comments
 (0)