Skip to content

Commit

Permalink
Address valgrind warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kishorenc committed Sep 4, 2018
1 parent c8dec7d commit 8480920
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker/debugger.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:16.04
FROM ubuntu:18.04

RUN apt-get update
RUN apt-get install -y gdb valgrind
4 changes: 2 additions & 2 deletions include/array_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class array_base {
public:
array_base(const uint32_t n=2) {
size_bytes = METADATA_OVERHEAD + (n * FOR_ELE_SIZE);
in = new uint8_t[size_bytes];
in = (uint8_t *) malloc(size_bytes * sizeof *in);
memset(in, 0, size_bytes);
}

~array_base() {
delete[] in;
free(in);
in = nullptr;
}

Expand Down
1 change: 1 addition & 0 deletions include/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct StringUtils {

~StringUtils() {
//delete transliterator;
iconv_close(cd);
}

// Adapted from: http://stackoverflow.com/a/236180/131050
Expand Down
2 changes: 2 additions & 0 deletions src/collection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ Option<bool> CollectionManager::init(Store *store, const std::string & auth_key,
iter->Next();
}

delete iter;

return Option<bool>(true);
}

Expand Down
2 changes: 1 addition & 1 deletion src/sorted_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void sorted_array::load(const uint32_t *sorted_array, const uint32_t array_lengt
uint8_t *out = new uint8_t[size_required];
uint32_t actual_size = for_compress_sorted(sorted_array, out, array_length);

delete[] in;
free(in);
in = nullptr;

in = out;
Expand Down

0 comments on commit 8480920

Please sign in to comment.