Commit 04d84469 authored by zhanxw's avatar zhanxw

not access uninitialized memory

parent 532b865f
......@@ -32,7 +32,10 @@ int BGenIndex::queryRange(const std::string& chrom, int begin, int end) {
}
int BGenIndex::setRange(const RangeList& r) {
sqlite3_finalize(stmt_);
if (stmt_) {
sqlite3_finalize(stmt_);
stmt_ = NULL;
}
this->range.setRange(r);
resetRangeIterator();
......
......@@ -25,8 +25,8 @@ CREATE TABLE Variant (
) WITHOUT ROWID;
*/
public:
BGenIndex() {}
BGenIndex(const std::string& fn) { init(fn); }
BGenIndex() : db_(NULL), stmt_(NULL) {}
BGenIndex(const std::string& fn) : db_(NULL), stmt_(NULL) { init(fn); }
int init(const std::string& fn);
/**
* 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