Skip to content

Commit ffb1980

Browse files
committed
Remove remaining pgut_strdup() uses in favor of num_buff,
so no more of those tiny leaks.
1 parent 775a97d commit ffb1980

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bin/pg_repack.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ repack_one_table(repack_table *table, const char *orderby)
13921392
elog(DEBUG2, "---- drop ----");
13931393

13941394
command("BEGIN ISOLATION LEVEL READ COMMITTED", 0, NULL);
1395-
params[1] = utoa(temp_obj_num, pgut_strdup(buffer));
1395+
params[1] = utoa(temp_obj_num, indexbuffer);
13961396
command("SELECT repack.repack_drop($1, $2)", 2, params);
13971397
command("COMMIT", 0, NULL);
13981398
temp_obj_num = 0; /* reset temporary object counter after cleanup */
@@ -1414,7 +1414,7 @@ repack_one_table(repack_table *table, const char *orderby)
14141414

14151415
/* Release advisory lock on table. */
14161416
params[0] = REPACK_LOCK_PREFIX_STR;
1417-
params[1] = utoa(table->target_oid, pgut_strdup(buffer));
1417+
params[1] = utoa(table->target_oid, buffer);
14181418

14191419
res = pgut_execute(connection, "SELECT pg_advisory_unlock($1, CAST(-2147483648 + $2::bigint AS integer))",
14201420
2, params);
@@ -1703,11 +1703,12 @@ repack_cleanup_callback(bool fatal, void *userdata)
17031703
Oid target_table = *(Oid *) userdata;
17041704
const char *params[2];
17051705
char buffer[12];
1706+
char num_buff[12];
17061707

17071708
if(fatal)
17081709
{
17091710
params[0] = utoa(target_table, buffer);
1710-
params[1] = utoa(temp_obj_num, pgut_strdup(buffer));
1711+
params[1] = utoa(temp_obj_num, num_buff);
17111712

17121713
/* testing PQstatus() of connection and conn2, as we do
17131714
* in repack_cleanup(), doesn't seem to work here,
@@ -1733,6 +1734,7 @@ repack_cleanup(bool fatal, const repack_table *table)
17331734
else
17341735
{
17351736
char buffer[12];
1737+
char num_buff[12];
17361738
const char *params[2];
17371739

17381740
/* Try reconnection if not available. */
@@ -1742,7 +1744,7 @@ repack_cleanup(bool fatal, const repack_table *table)
17421744

17431745
/* do cleanup */
17441746
params[0] = utoa(table->target_oid, buffer);
1745-
params[1] = utoa(temp_obj_num, pgut_strdup(buffer));
1747+
params[1] = utoa(temp_obj_num, num_buff);
17461748
command("SELECT repack.repack_drop($1, $2)", 2, params);
17471749
temp_obj_num = 0; /* reset temporary object counter after cleanup */
17481750
}

0 commit comments

Comments
 (0)