Re: [PATCH] Silence Valgrind about SelectConfigFiles() - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: [PATCH] Silence Valgrind about SelectConfigFiles()
Date
Msg-id CAJ7c6TMFgp5p9Erdh5PODXbwc2MT8ogiZQx3mcN0O3TXuOpoAQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Silence Valgrind about SelectConfigFiles()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] Silence Valgrind about SelectConfigFiles()
List pgsql-hackers
Hi Tom,

> Yeah, I noticed that too, and it does offend my inner neatnik.
>
> Instead of what you did, I'd be inclined to add
>
>         free(configdir);
>
>         return true;
> +
> +fail:
> +       free(configdir);
> +
> +       return false;
>  }
>
> and then s/return false/goto fail/ throughout, so as to avoid
> duplicating the free() calls.  It's a minor point as things stand,
> but if more cleanup gets added to the function I think it'd be
> easier to maintain this way.

Makes sense. Here is the corrected patch v2.

> Huh ... don't quite see where in that recipe we'd reach a
> SelectConfigFiles error exit.

How exactly we reach this code patch is a good question. I tried to
understand the exact conditions by using my steps to reproduce and an
ancient debugging technique with sleep(), elog() and `watch` - see
trick.txt. Unfortunately I was not able to reproduce it again nor
under Valgrind nor without it. I guess it means that either I did
something differently before or the right conditions are met under
rare circumstances.

Attachment

pgsql-hackers by date:

Previous
From: Alastair Turner
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Shinya Kato
Date:
Subject: Add mode column to pg_stat_progress_vacuum