Skip to content

rocksdb: member function call and member invalidation #58

@qqiangwu

Description

@qqiangwu
void ColumnFamilyData::CreateNewMemtable(
    const MutableCFOptions& mutable_cf_options, SequenceNumber earliest_seq) {
  if (mem_ != nullptr) {
    delete mem_->Unref();
  }
  SetMemtable(ConstructNewMemtable(mutable_cf_options, earliest_seq));
  mem_->Ref();
}

gives:

➜  rocksdb-main git:(main) ✗ cppsafe -p build db/column_family.cc
/Users/wuqq/dev/rocksdb-main/db/column_family.cc:1137:3: warning: passing a dangling pointer as argument
 1137 |   mem_->Ref();
      |   ^~~~
/Users/wuqq/dev/rocksdb-main/db/column_family.cc:1134:5: note: deleted here
 1134 |     delete mem_->Unref();
      |     ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions