Skip to content

Commit ac7009a

Browse files
committed
pg_upgrade: fix one-byte per empty db memory leak
Report by Tatsuo Ishii, Coverity
1 parent c4fda14 commit ac7009a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

contrib/pg_upgrade/relfilenode.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,8 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
110110
pg_fatal("old database \"%s\" not found in the new cluster\n",
111111
old_db->db_name);
112112

113-
n_maps = 0;
114113
mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata,
115114
new_pgdata);
116-
117115
if (n_maps)
118116
{
119117
print_maps(mappings, n_maps, new_db->db_name);
@@ -123,9 +121,9 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
123121
#endif
124122
transfer_single_new_db(pageConverter, mappings, n_maps,
125123
old_tablespace);
126-
127-
pg_free(mappings);
128124
}
125+
/* We allocate something even for n_maps == 0 */
126+
pg_free(mappings);
129127
}
130128

131129
return;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy