1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

jit: Fix accidentally-harmless type confusion

In 2a0faed9d7, which added JIT compilation support for expressions, I
accidentally used sizeof(LLVMBasicBlockRef *) instead of
sizeof(LLVMBasicBlockRef) as part of computing the size of an allocation. That
turns out to have no real negative consequences due to LLVMBasicBlockRef being
a pointer itself (and thus having the same size). It still is wrong and
confusing, so fix it.

Reported by coverity.

Backpatch-through: 13
This commit is contained in:
Andres Freund
2025-11-04 18:36:18 -05:00
parent d115de9d89
commit 2d83d729d5

View File

@@ -2505,7 +2505,7 @@ llvm_compile_expr(ExprState *state)
v_nullsp = l_ptr_const(nulls, l_ptr(TypeStorageBool)); v_nullsp = l_ptr_const(nulls, l_ptr(TypeStorageBool));
/* create blocks for checking args */ /* create blocks for checking args */
b_checknulls = palloc(sizeof(LLVMBasicBlockRef *) * nargs); b_checknulls = palloc(sizeof(LLVMBasicBlockRef) * nargs);
for (int argno = 0; argno < nargs; argno++) for (int argno = 0; argno < nargs; argno++)
{ {
b_checknulls[argno] = b_checknulls[argno] =