Skip to content

Commit

Permalink
rgw: Avoid dereferencing nullptr while configuring bucket sync policy
Browse files Browse the repository at this point in the history
While configuring bucket sync policy, in "rgw_sync_bucket_entities::set_bucket()",
there could be a case where in bucket doesnt contain any value but is still being
dereferenced. This commit fixes the same.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
  • Loading branch information
soumyakoduri committed May 26, 2022
1 parent 805d232 commit 86cf827
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rgw/rgw_sync_policy.cc
Expand Up @@ -258,6 +258,10 @@ void rgw_sync_bucket_entities::set_bucket(std::optional<string> tenant,
bucket.emplace();
}

if (!bucket) {
return;
}

set_bucket_field(tenant, &bucket->tenant);
set_bucket_field(bucket_name, &bucket->name);
set_bucket_field(bucket_id, &bucket->bucket_id);
Expand Down

0 comments on commit 86cf827

Please sign in to comment.