Fix valgrind error in c_test
Summary:
External contribution caused some valgrind errors: 1a34aaaef0
This diff fixes them
Test Plan: ran valgrind
Reviewers: sdong, yhchiang, ljin
Reviewed By: ljin
Subscribers: leveldb
Differential Revision: https://reviews.facebook.net/D19485
This commit is contained in:
parent
8f6e9ab209
commit
8a03935f8c
7
db/c.cc
7
db/c.cc
@ -507,6 +507,13 @@ char** rocksdb_list_column_families(
|
|||||||
return column_families;
|
return column_families;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rocksdb_list_column_families_destroy(char** list, size_t len) {
|
||||||
|
for (size_t i = 0; i < len; ++i) {
|
||||||
|
free(output[i]);
|
||||||
|
}
|
||||||
|
free(output);
|
||||||
|
}
|
||||||
|
|
||||||
rocksdb_column_family_handle_t* rocksdb_create_column_family(
|
rocksdb_column_family_handle_t* rocksdb_create_column_family(
|
||||||
rocksdb_t* db,
|
rocksdb_t* db,
|
||||||
const rocksdb_options_t* column_family_options,
|
const rocksdb_options_t* column_family_options,
|
||||||
|
@ -580,6 +580,7 @@ int main(int argc, char** argv) {
|
|||||||
CheckEqual("default", column_fams[0], 7);
|
CheckEqual("default", column_fams[0], 7);
|
||||||
CheckEqual("cf1", column_fams[1], 3);
|
CheckEqual("cf1", column_fams[1], 3);
|
||||||
CheckCondition(cflen == 2);
|
CheckCondition(cflen == 2);
|
||||||
|
rocksdb_list_column_families_destroy(column_fams, cflen);
|
||||||
|
|
||||||
rocksdb_options_t* cf_options = rocksdb_options_create();
|
rocksdb_options_t* cf_options = rocksdb_options_create();
|
||||||
|
|
||||||
@ -631,14 +632,15 @@ int main(int argc, char** argv) {
|
|||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
rocksdb_column_family_handle_destroy(handles[i]);
|
rocksdb_column_family_handle_destroy(handles[i]);
|
||||||
}
|
}
|
||||||
|
rocksdb_close(db);
|
||||||
|
rocksdb_destroy_db(options, dbname, &err);
|
||||||
|
rocksdb_options_destroy(db_options);
|
||||||
|
rocksdb_options_destroy(cf_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
StartPhase("prefix");
|
StartPhase("prefix");
|
||||||
{
|
{
|
||||||
// Create new database
|
// Create new database
|
||||||
rocksdb_close(db);
|
|
||||||
rocksdb_destroy_db(options, dbname, &err);
|
|
||||||
|
|
||||||
rocksdb_filterpolicy_t* policy = rocksdb_filterpolicy_create_bloom(10);
|
rocksdb_filterpolicy_t* policy = rocksdb_filterpolicy_create_bloom(10);
|
||||||
rocksdb_options_set_filter_policy(options, policy);
|
rocksdb_options_set_filter_policy(options, policy);
|
||||||
rocksdb_options_set_prefix_extractor(options, rocksdb_slicetransform_create_fixed_prefix(3));
|
rocksdb_options_set_prefix_extractor(options, rocksdb_slicetransform_create_fixed_prefix(3));
|
||||||
|
@ -119,6 +119,7 @@ char** rocksdb_list_column_families(
|
|||||||
const char* name,
|
const char* name,
|
||||||
size_t* lencf,
|
size_t* lencf,
|
||||||
char** errptr);
|
char** errptr);
|
||||||
|
void rocksdb_list_column_families_destroy(char** list, size_t len);
|
||||||
|
|
||||||
extern rocksdb_column_family_handle_t* rocksdb_create_column_family(
|
extern rocksdb_column_family_handle_t* rocksdb_create_column_family(
|
||||||
rocksdb_t* db,
|
rocksdb_t* db,
|
||||||
|
Loading…
Reference in New Issue
Block a user