Skip to content

Commit

Permalink
deallocate memory correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Mar 16, 2011
1 parent ab9979c commit 9d4e6cd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/mapnik_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ Handle<Value> Map::render_to_file(const Arguments& args)
}


typedef struct {
struct grid_t {
Map *m;
std::size_t layer_idx;
unsigned int step;
Expand All @@ -939,7 +939,17 @@ typedef struct {
std::map<std::string, std::map<std::string, mapnik::value> > features;
std::vector<std::string> key_order;
Persistent<Function> cb;
} grid_t;

grid_t() : m(NULL), grid(NULL) {
}

~grid_t() {
if (grid) {
delete grid;
grid = NULL;
}
}
};

void grid2utf(agg_grid::grid_rendering_buffer& renbuf,
grid_t* closure,
Expand Down

0 comments on commit 9d4e6cd

Please sign in to comment.