Avoid handle leak (src/bin/pg_ctl/pg_ctl.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid handle leak (src/bin/pg_ctl/pg_ctl.c)
Date: 2025-10-24 00:51:14
Message-ID: CAEudQApqP-9nvK7ZqU9Kw7vy8fGMhhzMWCqVAMbcKy4PixKSQw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Per Coverity.

The function *CreateRestrictedProcess* is responsible to create a
restricted token
Coverity complains that the handle origToken can be leaked.

In case of failure of the functions *AllocateAndInitializeSid* or
*GetPrivilegesToDelete*
the handle origToken must be released.

Trivial patch attached.

best regards,
Ranier Vilela

Attachment Content-Type Size
avoid-leak-handle-pg_ctl.patch application/octet-stream 687 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-10-24 00:57:38 Re: [Proposal] Adding callback support for custom statistics kinds
Previous Message Sami Imseih 2025-10-24 00:49:55 Re: Bug in pg_stat_statements