Commit 04d84469 authored by zhanxw's avatar zhanxw
Browse files

not access uninitialized memory

parent 532b865f
...@@ -32,7 +32,10 @@ int BGenIndex::queryRange(const std::string& chrom, int begin, int end) { ...@@ -32,7 +32,10 @@ int BGenIndex::queryRange(const std::string& chrom, int begin, int end) {
} }
int BGenIndex::setRange(const RangeList& r) { int BGenIndex::setRange(const RangeList& r) {
sqlite3_finalize(stmt_); if (stmt_) {
sqlite3_finalize(stmt_);
stmt_ = NULL;
}
this->range.setRange(r); this->range.setRange(r);
resetRangeIterator(); resetRangeIterator();
......
...@@ -25,8 +25,8 @@ CREATE TABLE Variant ( ...@@ -25,8 +25,8 @@ CREATE TABLE Variant (
) WITHOUT ROWID; ) WITHOUT ROWID;
*/ */
public: public:
BGenIndex() {} BGenIndex() : db_(NULL), stmt_(NULL) {}
BGenIndex(const std::string& fn) { init(fn); } BGenIndex(const std::string& fn) : db_(NULL), stmt_(NULL) { init(fn); }
int init(const std::string& fn); int init(const std::string& fn);
/** /**
* Contruct a SQL based on the specified range chrom:begin-end * Contruct a SQL based on the specified range chrom:begin-end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment