[PATCH] Resource leaks (src/backend/libpq/hba.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Resource leaks (src/backend/libpq/hba.c)
Date: 2020-08-25 13:20:07
Message-ID: CAEudQAo3Zamas2S=A8mRBJOBAyyn5Vg1FukGT=M8yZEvC8XfVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

Per Coverity.

The function parse_hba_auth_op at (src/backend/libpq/hba.c) allows resource
leaks when called
by the function parse_hba_line, with parameters LOG and DEBUG3 levels.

The function SplitGUCList (src/bin/pg_dump/dumputils.c) allows even
returning FALSE,
that namelist list is not empty and as memory allocated by pg_malloc.

The simplest solution is free namelist, even when calling ereport, why the
level can be
LOG or DEBUG3.

regards,
Ranier Vilela

PS. Are two SplitGUCList in codebase.
1. SplitGUCList (src/bin/pg_dump/dumputils.c)
2. SplitGUCList (src/backend/utils/adt/varlena.c)

Attachment Content-Type Size
fix_resource_leak_dba.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2020-08-25 13:21:48 Re: Problems with the FSM, heap fillfactor, and temporal locality
Previous Message Tomas Vondra 2020-08-25 13:18:02 Re: Fix a couple of misuages of bms_num_members()