Fixing memory leak in pg_upgrade

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fixing memory leak in pg_upgrade
Date: 2015-01-09 12:23:50
Message-ID: 20150109.212350.1299395873280569132.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

According to Coverity, there's a memory leak bug in transfer_all_new_dbs().

mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata,
new_pgdata);

if (n_maps)
{
print_maps(mappings, n_maps, new_db->db_name);

#ifdef PAGE_CONVERSION
pageConverter = setupPageConverter();
#endif
transfer_single_new_db(pageConverter, mappings, n_maps,
old_tablespace);

pg_free(mappings);
}
-----> leaks "mappings"
}
return;
}

This is because gen_db_file_maps() allocates memory even if n_maps == 0.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-01-09 12:38:35 Re: Fixing memory leak in pg_upgrade
Previous Message Dean Rasheed 2015-01-09 10:22:03 Re: INSERT ... ON CONFLICT UPDATE and RLS