1
0
Fork 0

Fix memleaks in coordinator.

This commit is contained in:
Willi Goesgens 2015-06-30 14:36:37 +02:00
parent c87575ce33
commit 1dea6b29a5
2 changed files with 8 additions and 4 deletions

View File

@ -1452,7 +1452,7 @@ int ClusterInfo::ensureIndexCoordinator (string const& databaseName,
const double endTime = TRI_microtime() + realTimeout;
const double interval = getPollInterval();
resultJson = 0;
resultJson = nullptr;
TRI_json_t* newIndex = nullptr;
int numberOfShards = 0;

View File

@ -652,7 +652,8 @@ void RestReplicationHandler::handleCommandBatch () {
TRI_json_t json;
TRI_InitObjectJson(TRI_CORE_MEM_ZONE, &json);
char* idString = TRI_StringUInt64((uint64_t) id);
TRI_Insert3ObjectJson(TRI_CORE_MEM_ZONE, &json, "id", TRI_CreateStringJson(TRI_CORE_MEM_ZONE, idString, strlen(idString)));
TRI_Insert3ObjectJson(TRI_CORE_MEM_ZONE, &json, "id",
TRI_CreateStringJson(TRI_CORE_MEM_ZONE, idString, strlen(idString)));
generateResult(&json);
TRI_DestroyJson(TRI_CORE_MEM_ZONE, &json);
@ -1832,8 +1833,8 @@ int RestReplicationHandler::processRestoreCollectionCoordinator (
TRI_voc_tick_t new_id_tick = ci->uniqid(1);
string new_id = StringUtils::itoa(new_id_tick);
TRI_ReplaceObjectJson(TRI_UNKNOWN_MEM_ZONE, parameters, "id",
TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE,
new_id.c_str(), new_id.size()));
TRI_CreateStringCopyJson(TRI_UNKNOWN_MEM_ZONE,
new_id.c_str(), new_id.size()));
// Now put in the primary and an edge index if needed:
TRI_json_t* indexes = TRI_CreateArrayJson(TRI_UNKNOWN_MEM_ZONE);
@ -2054,6 +2055,9 @@ int RestReplicationHandler::processRestoreIndexesCoordinator (
TRI_json_t* res_json = nullptr;
res = ci->ensureIndexCoordinator(dbName, col->id_as_string(), idxDef,
true, triagens::arango::Index::Compare, res_json, errorMsg, 3600.0);
if (res_json != nullptr) {
TRI_FreeJson(TRI_UNKNOWN_MEM_ZONE, res_json);
}
if (res != TRI_ERROR_NO_ERROR) {
errorMsg = "could not create index: " + string(TRI_errno_string(res));
break;