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.96) (envelope-from ) id 1w7qOz-005kb0-1q for pgsql-general@arkaria.postgresql.org; Wed, 01 Apr 2026 07:54:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7qOx-00FrUN-05 for pgsql-general@arkaria.postgresql.org; Wed, 01 Apr 2026 07:54:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7qOw-00FrUF-2H for pgsql-general@lists.postgresql.org; Wed, 01 Apr 2026 07:54:11 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7qOu-00000002Jhn-0HiH for pgsql-general@lists.postgresql.org; Wed, 01 Apr 2026 07:54:10 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-35d9749c26dso3064574a91.2 for ; Wed, 01 Apr 2026 00:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775030047; cv=none; d=google.com; s=arc-20240605; b=H3+jmbbBhzCyc/oZ29H1VefG3/lS4B4n+lfw5oEIhckn8gx+IQIsc6+FY18JS3WRqD w61k+hwrpNp0U1HbRQH3UyDryOpKi8ETw5eCiUr3OWxQeXTjVdNTvuwDptMXoZtShrWU +jZ906QnjCTmtZhbBcy/BJQNy3ryLSTQATejatE43s5RyNP5OqlLtyAXijvSxBsABHlg jXYbGzKTCgp7MLaQDJ16SYLFfRMAk30FWwDHSuX7Na6JroI9Pp95XmH85HLRjGzbk/MV 0oEjTtHrEi4vg7DwfgJzwfdWujeSH8pno2cdW4jBrk+7bZZTAIcDnl0L0plsefs8rzfc b8ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=2YJ+SZ0xNYrdAoQSZg+Uss5iMELpQ+2magep5ErpsUU=; fh=MqX3/PjeIRWyveucHIwmT3MEzIvphFWgoM5FEnVDTkI=; b=f0461M4WvQjZw+BIgghq7nPOT9Ci98uNDjgX6YJiepcoBxSFGexk0xkNcOjGyr5CK/ 8tATgldHp8m/Oq5JgpauqGeKD6ZpyGcx2U8ZJuFLoVD+NK4Hl9tta9kQu5tVA1U+xb/h vXZzeMoM6JZ4uecw687aJ4W3pD7acMXyrWMKiIhba5aOaeQf8j6wk8pFOgmfckH1twar 69fB4GIGMUVG63KvF+/u2OyPi2P5ekx+meE1vUqmgHP2O2Wd5KvrJo68REQYidAaY7lO zc1GLWEIHR4DypI7mGFTF5vflknw3AUhBElNKj3zUklHZtuVPiorzpcmgWH2n9rLAsUg b0Uw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775030047; x=1775634847; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2YJ+SZ0xNYrdAoQSZg+Uss5iMELpQ+2magep5ErpsUU=; b=i+S//JjBNYqoFWswCnJBsn0aTFaVGSQ62h8k771AgMIAgPAqzk/F/Drc9YKyqIL+Q/ cdWCkhCvyj6hOy2ZlLXsRl+WHLfAGBKsNtMTXpuwSEaBfhbPljkmlLO42qncBKkhS+gN aOaS3drWqusk38X3X9mLsqdXl2GwIGkjJT6R6AM/8aQ17fps/gk862sOni5QLSN7dhkJ 6p3wkRCluqVGMQZlWUqsPaIV4S2Qci5wCU7O3bgtgQ2bVkIDpX/zkSf3+PN6g/pWCYuD EEAW76PFnEEM3vDSIdYXNT/FnLHhtdUAeKM1mhI8/ARekN9Q8aNoF9IrK09Kt3o7orD9 tGCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775030047; x=1775634847; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2YJ+SZ0xNYrdAoQSZg+Uss5iMELpQ+2magep5ErpsUU=; b=NZS1UNZOh92yWGZAtjpdPgmCN8mohe52UwZE6kvx3uMUSwT4cEOF9mcf++H8M9JYab Liu9GU9n2UjQD3iyoXtKvGuXBiu3otelk0x2z2RqzRnoB03z+YzbRk3yt+88PK7VoEEy 8r33xzmv9ltcO71FzPQ3RKTgZlxuPa58U81jDuTA2NdA/V6zL0M2D/1ONmePv8AktlHQ mznq7d4rkHTUQtoQV5RuIdoAwbMy60jbj9IIfwy6P7OYmVUN+I0em2QLXTLjY4XqY2Nw ZfFqOqFeM7xzNI28R4+ib/V7yM6BboEEPRl0fYm3WzFU0u+rlwgNgmncIKfPmwQY1JBQ HD7w== X-Gm-Message-State: AOJu0YzmOO0JOl1bjMU3zdqjzXdsKG2ZCZ1ERLBpEDSXAEWlPMuajiz1 oGvjFqHatBuG79Q4/HG7Geb8qtUSBBrdRhMY5aP3K/zOU0CjWo7WnzKeOclGVp82UxozRXVSILf 4FFh6+6eIK3AU8O1q4v/AyiwzCFJCyIo= X-Gm-Gg: ATEYQzz2bmBRzblVJADNXSOF6IQXiJfeP1d2sYUoJdUM5i2oLFtqUmDO0flgPAgi6Iu 4HObL/vHVLGGEoVATYgqeHiM3LexB+YPAng8GRb7vqlDNH2Bwoz04ShyDMs2UZYFDOgCI+OA6Ux cQrtujKkamQB2FgRmrx7uqpluiYfuhgyJLQrx96ckKZ5WSPsAW3LSqI+jDFjX15hVLNAKEjQFrD DbDeBirumHqo7QJZAI1IADSbmypghle6i9YO88rc1ZOBgdLkj6TIO8lgwHpf2bstcW8MK5ySNa0 +VlF6v1rpw== X-Received: by 2002:a17:90b:3f8f:b0:359:fe72:3559 with SMTP id 98e67ed59e1d1-35dc6f7feacmr2422922a91.21.1775030046652; Wed, 01 Apr 2026 00:54:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dominique Devienne Date: Wed, 1 Apr 2026 09:53:55 +0200 X-Gm-Features: AQROBzB_nKmiXT1C1PxeCnt7GBNoCgmyUeDwLA64G_k9gj6DdviR9X9MUfw0W-0 Message-ID: Subject: Re: Any reason why PQclear() do not assign the pointer to NULL? To: Igor Korot Cc: "pgsql-generallists.postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Well yes, the fact you're asking is surprising. void PQclear(PGresult* res); How could it? C/C++ is pass by value. So PQclear gets a copy of the pointer. Even if it assigns it internal to nullptr, the calling code has its own unchanged copy. It's the same reason free() doesn't either. It's your responsability to assign nullptr after the PQclear. In/out argument in general violate the Principle of Least Surprise, and are best avoided. You have no way to know reading the code the call has a side effect on the var (as opposed to the value). FWIW. --DD