Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed CORE-5562: Firebird crashes when UDF gets loaded and unloaded f…
…requently
  • Loading branch information
AlexPeshkoff committed Jun 8, 2017
1 parent 479b57d commit 68aa9c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/jrd/flu.cpp
Expand Up @@ -268,11 +268,20 @@ namespace Jrd
return Module();
}

Module::~Module()
{
if (interMod)
{
Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION);
interMod = NULL; // This makes RefPtr call release()
}
}

Module::InternalModule::~InternalModule()
{
delete handle;
fb_assert(modulesMutex->locked());

Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION);
delete handle;

for (FB_SIZE_T m = 0; m < loadedModules().getCount(); m++)
{
Expand Down
2 changes: 2 additions & 0 deletions src/jrd/flu.h
Expand Up @@ -102,6 +102,8 @@ namespace Jrd
: interMod(m.interMod)
{ }

~Module();

// used for UDF/BLOB Filter
static FPTR_INT lookup(const char*, const char*, Firebird::SortedObjectsArray<Module>&);

Expand Down

0 comments on commit 68aa9c1

Please sign in to comment.