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
main
Igor Canadi 11 years ago
parent 8f6e9ab209
commit 8a03935f8c
  1. 7
      db/c.cc
  2. 8
      db/c_test.c
  3. 1
      include/rocksdb/c.h

@ -507,6 +507,13 @@ char** rocksdb_list_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_t* db,
const rocksdb_options_t* column_family_options,

@ -580,6 +580,7 @@ int main(int argc, char** argv) {
CheckEqual("default", column_fams[0], 7);
CheckEqual("cf1", column_fams[1], 3);
CheckCondition(cflen == 2);
rocksdb_list_column_families_destroy(column_fams, cflen);
rocksdb_options_t* cf_options = rocksdb_options_create();
@ -631,14 +632,15 @@ int main(int argc, char** argv) {
for (i = 0; i < 2; 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");
{
// Create new database
rocksdb_close(db);
rocksdb_destroy_db(options, dbname, &err);
rocksdb_filterpolicy_t* policy = rocksdb_filterpolicy_create_bloom(10);
rocksdb_options_set_filter_policy(options, policy);
rocksdb_options_set_prefix_extractor(options, rocksdb_slicetransform_create_fixed_prefix(3));

@ -119,6 +119,7 @@ char** rocksdb_list_column_families(
const char* name,
size_t* lencf,
char** errptr);
void rocksdb_list_column_families_destroy(char** list, size_t len);
extern rocksdb_column_family_handle_t* rocksdb_create_column_family(
rocksdb_t* db,

Loading…
Cancel
Save