fix memory leak

This commit is contained in:
Jindřich Makovička 2012-05-12 12:19:17 +02:00
parent 94746f019a
commit 59e6701969
2 changed files with 3 additions and 5 deletions

View file

@ -181,9 +181,6 @@ struct SearchQuery {
SearchQuery(int l, int r, int t, int b, RenderingRuleSearchRequest* req, ResultPublisher* publisher) :
req(req), left(l), right(r), top(t), bottom(b),publisher(publisher) {
if(publisher == NULL) {
publisher = new ResultPublisher();
}
numberOfAcceptedObjects = numberOfVisitedObjects = 0;
numberOfAcceptedSubtrees = numberOfReadSubtrees = 0;
ocean = land = false;

View file

@ -191,8 +191,8 @@ void runSimpleRendering( string renderingFileName, string resourceDir, Rendering
RenderingRulesStorage* st = new RenderingRulesStorage(renderingFileName.c_str());
st->parseRulesFromXmlInputStream(renderingFileName.c_str(), NULL);
RenderingRuleSearchRequest* searchRequest = new RenderingRuleSearchRequest(st);
SearchQuery q(floor(info->left), floor(info->right), ceil(info->top), ceil(info->bottom), searchRequest,
new ResultPublisher());
ResultPublisher* publisher = new ResultPublisher()
SearchQuery q(floor(info->left), floor(info->right), ceil(info->top), ceil(info->bottom), searchRequest, publisher);
q.zoom = info->zoom;
ResultPublisher* res = searchObjectsForRendering(&q, true, "Nothing found");
@ -244,6 +244,7 @@ void runSimpleRendering( string renderingFileName, string resourceDir, Rendering
} else {
osmand_log_print(LOG_INFO, "Tile successfully saved to %s", info->tileFileName.c_str());
}
delete publisher;
delete canvas;
delete bitmap;
free(bitmapData);