Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u5RTS-000M0j-Mb for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Apr 2025 15:48:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u5RTP-00BE1r-Eg for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Apr 2025 15:48:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u5RTP-00BE1i-3l for pgsql-hackers@lists.postgresql.org; Thu, 17 Apr 2025 15:48:19 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u5RTM-000YyH-1F for pgsql-hackers@lists.postgresql.org; Thu, 17 Apr 2025 15:48:18 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-6e8f6970326so8681156d6.0 for ; Thu, 17 Apr 2025 08:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1744904896; x=1745509696; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+HZmhNRhHoAxuKOwnO8pwKaCnuOAtkYyyJbp4vS1V1Y=; b=bNbaAMpKbU6l+/iLgBfGyBybUIvDAO5J6qoPHSwaFln4PMNlPzDVbiwB+pCKjNIULA J0B5t1jmJBljS3MVc3P6QT1+KZiTswxdCAZVSNbacW4+sdmdEKUPav7noSNWYJyM07Ti mc327+QQnGUSMkkJCAbUChk5fknsJBsLEOBOpL46iFLNxgthHZuwEyYs9e2mploCEsyJ aLuGYQJkKeyf8qrptJd2j7vJYNj0Y1YZstVu8x2ufYKG3TKwfes05bB2SR+pFi9hT5qd CzoqliSVH7s/HAsicJhX2v6F3qLLHF0EhoongGHW2rfGf4EP1giQ13dA+1ly3ysmMTyo 3APw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744904896; x=1745509696; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+HZmhNRhHoAxuKOwnO8pwKaCnuOAtkYyyJbp4vS1V1Y=; b=aaaoVhsks0tswMmPOJyUvr1WZeFEM81Zz6rVqjl62wEtIMYUY2BexAs5vmK0OpJwVp IV+cIZJarcuHeLHPu4kSVLugNtixtBh9vqT7Ce8RrbRA411MQj413cDVJCfnB2Sg4DMx DO8JTxxXELzd/+HqlNJ1LtRMH+caBE39Dh5rGPircjEdT9ujIZwDYHhB3WCyJNpHAqWM WpuAyHPr6J9okmGf2MJWAboeGGKUKw7xRc2bMy6jYfwcS0VH/tyrakviJ+RA813rFYkv Iv3+e3tCIm6enhOwVt69/zjFcLKwdPG/lpi66Zuqc5A7uJovRjE8fkP8iLalDvRvPK90 vQjQ== X-Forwarded-Encrypted: i=1; AJvYcCWvjh1Y1qD/ERDbhCew67D0Zv2dU2l7nv0MVM2tHFP7fsW6Abu5IRNEE8Eu4es/3F3cIVmm1ByDCJ84fCBJ@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0wp2stzWw5S76ibdDIYI/othxC/3vkovRsXS8J7pkDtpWKMkN 3pkUy+nx2Kw13wlSazc+yIRI0vNj71z7W7Y+AzkALsuGZLdq9ex+WtpATNGAFRAbW82EXgv/AH9 JssZq+tYqSLzo6O/p8scu0epW6NBNVKtPMI2D X-Gm-Gg: ASbGnctSD9rjHDxYWd9YyW1ezen8k4hkFVd7UtqIu7X9SyVkQ11HU2V0J/hI64mkEZm Iqyus2OkIR7RbHGPLsraO9zlHw5PQiKYAJ/PFs0yieFIB0msfIa5zKYuBBh4bKdCeLI2+DkOstv eUqs7Cp/xK1VEWYJQaU/4h X-Google-Smtp-Source: AGHT+IF2EtzmINFrx9yUFDc1n2+O/9fg412R6gyYzKY8plQtjyjxhQ6RV367awaL0gz8OZkCQeS9vmZw4nbVNFG0vaM= X-Received: by 2002:a05:6214:3008:b0:6e8:ebfa:42f9 with SMTP id 6a1803df08f44-6f2b2f41cafmr91569246d6.16.1744904895840; Thu, 17 Apr 2025 08:48:15 -0700 (PDT) MIME-Version: 1.0 References: <2074634.1744839761@sss.pgh.pa.us> <0A3CF5C4-9947-42E3-89A9-34FCF7BA95BA@yesql.se> <2078511.1744841564@sss.pgh.pa.us> <2084687.1744844690@sss.pgh.pa.us> <2087556.1744846124@sss.pgh.pa.us> <0A596D8B-24F3-408F-B89B-B42014B00A05@yesql.se> <2202326.1744903233@sss.pgh.pa.us> In-Reply-To: <2202326.1744903233@sss.pgh.pa.us> From: Jacob Champion Date: Thu, 17 Apr 2025 08:48:05 -0700 X-Gm-Features: ATxdqUGt6K_xNrnPXXshJH5n7nh5ZY7hSe9bGJz2a2hnkcmfHNSKFx6LZon83JE Message-ID: Subject: Re: jsonapi: scary new warnings with LTO enabled To: Tom Lane Cc: Daniel Gustafsson , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 17, 2025 at 8:20=E2=80=AFAM Tom Lane wrote: > I confirm this silences those warnings on my Fedora 41 box. Instead of doing lex =3D calloc(...); /* (error out on NULL return) */ makeJsonLexContextCstringLen(lex, ...); we need to do lex =3D makeJsonLexContextCstringLen(NULL, ...); /* (error out on NULL return) */ so that JSONLEX_FREE_STRUCT is set correctly. Otherwise we'll leak the main allocation: =3D=3D12550=3D=3DERROR: LeakSanitizer: detected memory leaks Direct leak of 120 byte(s) in 1 object(s) allocated from: #0 0xaaaae34d2a84 in __interceptor_calloc (/home/jacob/src/postgres/worktree-oauth/build-clang/src/interfaces/libpq/f= uzz_libpq_handle_oauth_sasl_error+0x112a84) (BuildId: 359bf20b63a97771ccb3bd2c238485920485521f) #1 0xaaaae3510ff0 in handle_oauth_sasl_error /home/jacob/src/postgres/worktree-oauth/build-clang/../src/interfaces/libpq= /fe-auth-oauth.c:511:8 > I'm content to do it like this, but maybe Jacob wants to > investigate alternatives? I was more worried about it when you said you wanted to get rid of the stack allocation API. (I like having the flexibility to choose between the two forms, not just for performance but also for struct embedding.) But I'm perfectly happy with just adjusting these sites. Thanks! --Jacob