@@ -243,13 +243,8 @@ static char *
243
243
utoa (unsigned int value , char * buffer )
244
244
{
245
245
sprintf (buffer , "%u" , value );
246
- /* XXX: originally, we would just return buffer here without
247
- * the pgut_strdup(). But repack_cleanup_callback() seems to
248
- * depend on getting back a freshly strdup'd copy of buffer,
249
- * not sure why. So now we are leaking a tiny bit of memory
250
- * with each utoa() call.
251
- */
252
- return pgut_strdup (buffer );
246
+
247
+ return buffer ;
253
248
}
254
249
255
250
static pgut_option options [] =
@@ -1397,7 +1392,7 @@ repack_one_table(repack_table *table, const char *orderby)
1397
1392
elog (DEBUG2 , "---- drop ----" );
1398
1393
1399
1394
command ("BEGIN ISOLATION LEVEL READ COMMITTED" , 0 , NULL );
1400
- params [1 ] = utoa (temp_obj_num , buffer );
1395
+ params [1 ] = utoa (temp_obj_num , indexbuffer );
1401
1396
command ("SELECT repack.repack_drop($1, $2)" , 2 , params );
1402
1397
command ("COMMIT" , 0 , NULL );
1403
1398
temp_obj_num = 0 ; /* reset temporary object counter after cleanup */
@@ -1708,11 +1703,12 @@ repack_cleanup_callback(bool fatal, void *userdata)
1708
1703
Oid target_table = * (Oid * ) userdata ;
1709
1704
const char * params [2 ];
1710
1705
char buffer [12 ];
1706
+ char num_buff [12 ];
1711
1707
1712
1708
if (fatal )
1713
1709
{
1714
1710
params [0 ] = utoa (target_table , buffer );
1715
- params [1 ] = utoa (temp_obj_num , buffer );
1711
+ params [1 ] = utoa (temp_obj_num , num_buff );
1716
1712
1717
1713
/* testing PQstatus() of connection and conn2, as we do
1718
1714
* in repack_cleanup(), doesn't seem to work here,
@@ -1738,6 +1734,7 @@ repack_cleanup(bool fatal, const repack_table *table)
1738
1734
else
1739
1735
{
1740
1736
char buffer [12 ];
1737
+ char num_buff [12 ];
1741
1738
const char * params [2 ];
1742
1739
1743
1740
/* Try reconnection if not available. */
@@ -1747,7 +1744,7 @@ repack_cleanup(bool fatal, const repack_table *table)
1747
1744
1748
1745
/* do cleanup */
1749
1746
params [0 ] = utoa (table -> target_oid , buffer );
1750
- params [1 ] = utoa (temp_obj_num , buffer );
1747
+ params [1 ] = utoa (temp_obj_num , num_buff );
1751
1748
command ("SELECT repack.repack_drop($1, $2)" , 2 , params );
1752
1749
temp_obj_num = 0 ; /* reset temporary object counter after cleanup */
1753
1750
}
0 commit comments