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