]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
jit: Fix accidentally-harmless type confusion
authorAndres Freund <andres@anarazel.de>
Tue, 4 Nov 2025 23:36:18 +0000 (18:36 -0500)
committerAndres Freund <andres@anarazel.de>
Wed, 5 Nov 2025 01:03:53 +0000 (20:03 -0500)
In 2a0faed9d702, 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

src/backend/jit/llvm/llvmjit_expr.c

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