1
0
Fork 0

fixed memleak

This commit is contained in:
Jan Steemann 2014-07-22 17:38:34 +02:00
parent 4c033b8962
commit 373f581990
1 changed files with 21 additions and 6 deletions

View File

@ -5596,6 +5596,9 @@ int TRI_InsertShapedJsonDocumentCollection (TRI_transaction_collection_t* trxCol
keyString = key; keyString = key;
} }
uint64_t const hash = TRI_HashKeyPrimaryIndex(keyString.c_str());
int res = TRI_ERROR_NO_ERROR; int res = TRI_ERROR_NO_ERROR;
if (marker == nullptr) { if (marker == nullptr) {
@ -5605,20 +5608,28 @@ int TRI_InsertShapedJsonDocumentCollection (TRI_transaction_collection_t* trxCol
else { else {
res = CreateMarkerWithLegend(marker, document, rid, trxCollection, keyString, shaped, edge); res = CreateMarkerWithLegend(marker, document, rid, trxCollection, keyString, shaped, edge);
} }
}
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
if (marker != nullptr) {
// avoid memleak
delete marker;
}
return res; return res;
} }
}
TRI_ASSERT(marker != nullptr); TRI_ASSERT(marker != nullptr);
uint64_t hash = TRI_HashKeyPrimaryIndex(keyString.c_str());
// now insert into indexes // now insert into indexes
{ {
TRI_IF_FAILURE("InsertDocumentNoLock") { TRI_IF_FAILURE("InsertDocumentNoLock") {
// test what happens if no lock can be acquired // test what happens if no lock can be acquired
if (freeMarker) {
delete marker;
}
return TRI_ERROR_DEBUG; return TRI_ERROR_DEBUG;
} }
@ -5743,6 +5754,10 @@ int TRI_UpdateShapedJsonDocumentCollection (TRI_transaction_collection_t* trxCol
} }
if (res != TRI_ERROR_NO_ERROR) { if (res != TRI_ERROR_NO_ERROR) {
if (marker != nullptr) {
// avoid memleak
delete marker;
}
return res; return res;
} }
} }