Permalink
Browse files

Fixing memory leak if no more memory available for allocating columns

  • Loading branch information...
mariano committed Jun 3, 2011
1 parent a5b004e commit 14561dd848f9df58b09c87c4d23dd8aab4047ecf
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/node-db
  2. +4 −0 src/result.cc
Submodule node-db updated 4 files
+1 −1 connection.h
+39 −31 query.cc
+6 −3 query.h
+40 −23 tests.js
View
@@ -88,6 +88,10 @@ node_db_drizzle::Result::Result(drizzle_st* drizzle, drizzle_result_st* result)
drizzle_column_st *current;
while ((current = drizzle_column_next(this->result)) != NULL) {
this->columns[i++] = new Column(current);
+ if (this->columns[i] == NULL) {
+ delete [] this->columns;
+ throw node_db::Exception("Could not allocate storage for column");
+ }
}
this->nextRow = this->row();

0 comments on commit 14561dd

Please sign in to comment.