| From: | Andres Freund <andres(at)anarazel(dot)de> | 
|---|---|
| To: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> | 
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: [PATCH] FIx resource leaks (pg_resetwal.c) | 
| Date: | 2020-04-23 18:27:03 | 
| Message-ID: | 20200423182703.g6gqxzzdoyib3jjk@alap3.anarazel.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi,
On 2020-04-23 15:20:59 -0300, Ranier Vilela wrote:
> Per Coverity.
> 
> read_controlfile alloc memory with pg_malloc and fail in releasing the
> memory.
Seriously, this is getting really ridiculous. You're posting badly
vetted, often nearly verbatim, coverity reports. Many of them are
obvious false positives. This is just producing noise.
Please stop.
> diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
> index 233441837f..673ab0204c 100644
> --- a/src/bin/pg_resetwal/pg_resetwal.c
> +++ b/src/bin/pg_resetwal/pg_resetwal.c
> @@ -608,6 +608,7 @@ read_controlfile(void)
>  	len = read(fd, buffer, PG_CONTROL_FILE_SIZE);
>  	if (len < 0)
>  	{
> +		pg_free(buffer);		
>  		pg_log_error("could not read file \"%s\": %m", XLOG_CONTROL_FILE);
>  		exit(1);
>  	}
There's an exit() two lines later, this is obviously not necessary.
Greetings,
Andres Freund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ranier Vilela | 2020-04-23 18:40:21 | Re: [PATCH] FIx resource leaks (pg_resetwal.c) | 
| Previous Message | Ranier Vilela | 2020-04-23 18:20:59 | [PATCH] FIx resource leaks (pg_resetwal.c) |