From 59e6701969dcfdfdc1a2c1eb6cc332c0e8eb5b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20Makovi=C4=8Dka?= Date: Sat, 12 May 2012 12:19:17 +0200 Subject: [PATCH] fix memory leak --- Osmand-kernel/osmand/src/binaryRead.h | 3 --- Osmand-kernel/osmand/src/osmand_main.cpp | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Osmand-kernel/osmand/src/binaryRead.h b/Osmand-kernel/osmand/src/binaryRead.h index 5de8133d59..0573ec12d2 100644 --- a/Osmand-kernel/osmand/src/binaryRead.h +++ b/Osmand-kernel/osmand/src/binaryRead.h @@ -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; diff --git a/Osmand-kernel/osmand/src/osmand_main.cpp b/Osmand-kernel/osmand/src/osmand_main.cpp index 2e0217bb24..65ccbb9e4d 100644 --- a/Osmand-kernel/osmand/src/osmand_main.cpp +++ b/Osmand-kernel/osmand/src/osmand_main.cpp @@ -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);