mirror of
https://github.com/postgres/postgres.git
synced 2025-06-05 23:56:58 +03:00
pg_upgrade: Fix memory leak in check_for_unicode_update().
This function was initializing the "task" variable before a couple of early returns. To fix, postpone the initialization until just before it's needed. Per Coverity. Discussion: https://postgr.es/m/Z_KMsUH2-FEbiNjC%40nathan
This commit is contained in:
parent
57dec20fd4
commit
de48056ec7
@ -1825,7 +1825,7 @@ static void
|
|||||||
check_for_unicode_update(ClusterInfo *cluster)
|
check_for_unicode_update(ClusterInfo *cluster)
|
||||||
{
|
{
|
||||||
UpgradeTaskReport report;
|
UpgradeTaskReport report;
|
||||||
UpgradeTask *task = upgrade_task_create();
|
UpgradeTask *task;
|
||||||
const char *query;
|
const char *query;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1920,6 +1920,7 @@ check_for_unicode_update(ClusterInfo *cluster)
|
|||||||
" d.datname = current_database() AND "
|
" d.datname = current_database() AND "
|
||||||
" d.encoding = pg_char_to_encoding('UTF8');";
|
" d.encoding = pg_char_to_encoding('UTF8');";
|
||||||
|
|
||||||
|
task = upgrade_task_create();
|
||||||
upgrade_task_add_step(task, query,
|
upgrade_task_add_step(task, query,
|
||||||
process_unicode_update,
|
process_unicode_update,
|
||||||
true, &report);
|
true, &report);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user