Skip to content

Commit 0afd864

Browse files
committed
Fixing memory leak if no more memory available for allocating columns
1 parent 7e13d0a commit 0afd864

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/result.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ node_db_mysql::Result::Result(MYSQL* connection) throw(node_db::Exception&)
9595

9696
for (uint16_t i = 0; i < this->totalColumns; i++) {
9797
this->columns[i] = new Column(fields[i]);
98+
if (this->columns[i] == NULL) {
99+
delete [] this->columns;
100+
throw node_db::Exception("Could not allocate storage for column");
101+
}
98102
}
99103
}
100104

0 commit comments

Comments
 (0)