[MASSMAIL]Fix resource leak (src/backend/libpq/be-secure-common.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject [MASSMAIL]Fix resource leak (src/backend/libpq/be-secure-common.c)
Date
Msg-id CAEudQAqMeE0AHcOsOzZx51Z0eiFJAjhBPRFt+Bxi3ETXWen7ig@mail.gmail.com
Whole thread Raw
Responses Re: Fix resource leak (src/backend/libpq/be-secure-common.c)
List pgsql-hackers
Hi,

Per Coverity.

Coverity reported a resource leak at the function run_ssl_passphrase_command.
7. alloc_fn: Storage is returned from allocation function wait_result_to_str.["show details"]
     
8. noescape: Assuming resource wait_result_to_str(pclose_rc) is not freed or pointed-to as ellipsis argument to errdetail_internal.
     
CID 1533043: (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Failing to save or free storage allocated by wait_result_to_str(pclose_rc) leaks it.

I think that Coverity is right.

Fix by freeing the pointer, like pclose_check (src/common/exec.c) similar case.

Patch attached.

best regards,
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Popcount optimization using AVX512
Next
From: Tomas Vondra
Date:
Subject: Re: using extended statistics to improve join estimates