diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 503c8bc840a..06b43e15745 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -1297,7 +1297,8 @@ llvm_create_object_layer(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *T { LLVMJITEventListenerRef l = LLVMCreatePerfJITEventListener(); - LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); + if (l) + LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); } #endif