Avoid resource leak (src/test/regress/pg_regress.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid resource leak (src/test/regress/pg_regress.c)
Date: 2025-10-24 00:37:21
Message-ID: CAEudQAquegvX32h5OL1Z1t8yn5wa2FAOhL5RMTqBer8ppzB4UA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Per Coverity.

The function *config_sspi_auth* is responsible for
rewrite pg_hba.conf and pg_ident.conf to use SSPI authentication.

Coverity complains that the struct addrinfo gai_result is leaked.
The variable is declared inside block and is not used
outside the block.

So if the function WSAStartup is successful then the function getaddrinfo
allocates and fills the struct addrinfo.

The memory must be released at the end of the block.

Trivial patch attached.

best regards,
Ranier Vilela

Attachment Content-Type Size
avoid-resource-leak-pg_regress.patch application/octet-stream 778 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-10-24 00:49:55 Re: Bug in pg_stat_statements
Previous Message Ranier Vilela 2025-10-24 00:26:24 Avoid resource leak (src/bin/pg_resetwal/pg_resetwal.c)