diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2025-02-12 16:07:23 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2025-02-12 16:07:23 -0500 |
commit | fd602f29c19d4f483f54d93abe240c12219d9f51 (patch) | |
tree | de05f5e8139dbbbededef7dbecaf041bd2550cc1 /src/backend/access/gist/gistxlog.c | |
parent | fcd77a6873018c06a34761b7be0c0d1fd847fdd5 (diff) | |
download | postgresql-fd602f29c19d4f483f54d93abe240c12219d9f51.tar.gz postgresql-fd602f29c19d4f483f54d93abe240c12219d9f51.zip |
Clean up impenetrable logic in pg_basebackup/receivelog.c.
Coverity complained about possible double free of HandleCopyStream's
"copybuf". AFAICS it's mistaken, but it is easy to see why it's
confused, because management of that buffer is impossibly confusing.
It's unreasonable that HandleEndOfCopyStream frees the buffer in some
cases but not others, updates the caller's state for that in no case,
and has not a single comment about how complicated that makes things.
Let's put all the responsibility for freeing copybuf in the actual
owner of that variable, HandleCopyStream. This results in one more
PQfreemem call than before, but the logic is far easier to follow,
both for humans and machines.
Since this isn't (quite) actually broken, no back-patch.
Diffstat (limited to 'src/backend/access/gist/gistxlog.c')
0 files changed, 0 insertions, 0 deletions