🌐 AI搜索 & 代理 主页
Skip to content

Commit 5b7bbf1

Browse files
committed
Fix allocation formula in llvmjit_expr.c
An array of LLVMBasicBlockRef is allocated with the size used for an element being "LLVMBasicBlockRef *" rather than "LLVMBasicBlockRef". LLVMBasicBlockRef is a type that refers to a pointer, so this did not directly cause a problem because both should have the same size, still it is incorrect. This issue has been spotted while reviewing a different patch, and exists since 2a0faed, so backpatch all the way down. Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com Backpatch-through: 14
1 parent e08f338 commit 5b7bbf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@ llvm_compile_expr(ExprState *state)
698698
LLVMBuildStore(b, l_sbool_const(1), v_resnullp);
699699

700700
/* create blocks for checking args, one for each */
701-
b_checkargnulls =
702-
palloc(sizeof(LLVMBasicBlockRef *) * op->d.func.nargs);
701+
b_checkargnulls = (LLVMBasicBlockRef *)
702+
palloc(sizeof(LLVMBasicBlockRef) * op->d.func.nargs);
703703
for (int argno = 0; argno < op->d.func.nargs; argno++)
704704
b_checkargnulls[argno] =
705705
l_bb_before_v(b_nonull, "b.%d.isnull.%d", opno,

0 commit comments

Comments
 (0)