1
0
Fork 0

handle out of memory in voc-shaper

This commit is contained in:
Jan Steemann 2013-03-12 09:20:56 +01:00
parent a091a72ef2
commit 082244cbeb
1 changed files with 7 additions and 3 deletions

View File

@ -1136,16 +1136,20 @@ TRI_shape_access_t const* TRI_FindAccessorVocShaper (TRI_shaper_t* s,
TRI_shape_access_t* accessor;
TRI_shape_access_t const* found;
TRI_LockMutex(&shaper->_accessorLock);
search._sid = sid;
search._pid = pid;
TRI_LockMutex(&shaper->_accessorLock);
found = TRI_LookupByElementAssociativePointer(&shaper->_accessors, &search);
if (found == NULL) {
found = accessor = TRI_ShapeAccessor(&shaper->base, sid, pid);
TRI_InsertElementAssociativePointer(&shaper->_accessors, accessor, true);
// TRI_ShapeAccessor can return a NULL pointer
if (found != NULL) {
TRI_InsertElementAssociativePointer(&shaper->_accessors, accessor, true);
}
}
TRI_UnlockMutex(&shaper->_accessorLock);