File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -441,7 +441,6 @@ set_locale_and_encoding(void)
441
441
char * datcollate_literal ;
442
442
char * datctype_literal ;
443
443
char * datlocale_literal = NULL ;
444
- char * datlocale_src ;
445
444
DbLocaleInfo * locale = old_cluster .template0 ;
446
445
447
446
prep_status ("Setting locale and encoding for new cluster" );
@@ -455,10 +454,13 @@ set_locale_and_encoding(void)
455
454
datctype_literal = PQescapeLiteral (conn_new_template1 ,
456
455
locale -> db_ctype ,
457
456
strlen (locale -> db_ctype ));
458
- datlocale_src = locale -> db_locale ? locale -> db_locale : "NULL" ;
459
- datlocale_literal = PQescapeLiteral (conn_new_template1 ,
460
- datlocale_src ,
461
- strlen (datlocale_src ));
457
+
458
+ if (locale -> db_locale )
459
+ datlocale_literal = PQescapeLiteral (conn_new_template1 ,
460
+ locale -> db_locale ,
461
+ strlen (locale -> db_locale ));
462
+ else
463
+ datlocale_literal = "NULL" ;
462
464
463
465
/* update template0 in new cluster */
464
466
if (GET_MAJOR_VERSION (new_cluster .major_version ) >= 1700 )
@@ -502,7 +504,8 @@ set_locale_and_encoding(void)
502
504
503
505
PQfreemem (datcollate_literal );
504
506
PQfreemem (datctype_literal );
505
- PQfreemem (datlocale_literal );
507
+ if (locale -> db_locale )
508
+ PQfreemem (datlocale_literal );
506
509
507
510
PQfinish (conn_new_template1 );
508
511
You can’t perform that action at this time.
0 commit comments