public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ranier Vilela <[email protected]>
To: Pg Hackers <[email protected]>
Subject: Fix possible resource leak (src/bin/pg_basebackup/pg_receivewal.c)
Date: Tue, 11 Feb 2025 08:49:06 -0300
Message-ID: <CAEudQAoG0W7Y3hi+=bx5HhjaCiLs2EO6hw_aDDF8aLFU5AgTCQ@mail.gmail.com> (raw)

Hi.

Per Coverity.

CID 1591288: (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable sysidentifier going out of scope leaks the
storage it points to.

Trivial patch attached.

best regards,
Ranier Vilela


Attachments:

  [application/octet-stream] fix-resource-leak-pg_receivewal.patch (455B, ../CAEudQAoG0W7Y3hi+=bx5HhjaCiLs2EO6hw_aDDF8aLFU5AgTCQ@mail.gmail.com/3-fix-resource-leak-pg_receivewal.patch)
  download | inline diff:
diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c
index 176c40faca..69d279edea 100644
--- a/src/bin/pg_basebackup/pg_receivewal.c
+++ b/src/bin/pg_basebackup/pg_receivewal.c
@@ -547,6 +547,7 @@ StreamLog(void)
 			if (!GetSlotInformation(conn, replication_slot, &stream.startpos,
 									&stream.timeline))
 			{
+				pg_free(sysidentifier);
 				/* Error is logged by GetSlotInformation() */
 				return;
 			}


view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: Fix possible resource leak (src/bin/pg_basebackup/pg_receivewal.c)
  In-Reply-To: <CAEudQAoG0W7Y3hi+=bx5HhjaCiLs2EO6hw_aDDF8aLFU5AgTCQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox