@@ -408,7 +408,6 @@ set_locale_and_encoding(void)
408
408
char * datcollate_literal ;
409
409
char * datctype_literal ;
410
410
char * datlocale_literal = NULL ;
411
- char * datlocale_src ;
412
411
DbLocaleInfo * locale = old_cluster .template0 ;
413
412
414
413
prep_status ("Setting locale and encoding for new cluster" );
@@ -422,10 +421,13 @@ set_locale_and_encoding(void)
422
421
datctype_literal = PQescapeLiteral (conn_new_template1 ,
423
422
locale -> db_ctype ,
424
423
strlen (locale -> db_ctype ));
425
- datlocale_src = locale -> db_locale ? locale -> db_locale : "NULL" ;
426
- datlocale_literal = PQescapeLiteral (conn_new_template1 ,
427
- datlocale_src ,
428
- strlen (datlocale_src ));
424
+
425
+ if (locale -> db_locale )
426
+ datlocale_literal = PQescapeLiteral (conn_new_template1 ,
427
+ locale -> db_locale ,
428
+ strlen (locale -> db_locale ));
429
+ else
430
+ datlocale_literal = "NULL" ;
429
431
430
432
/* update template0 in new cluster */
431
433
if (GET_MAJOR_VERSION (new_cluster .major_version ) >= 1700 )
@@ -469,7 +471,8 @@ set_locale_and_encoding(void)
469
471
470
472
PQfreemem (datcollate_literal );
471
473
PQfreemem (datctype_literal );
472
- PQfreemem (datlocale_literal );
474
+ if (locale -> db_locale )
475
+ PQfreemem (datlocale_literal );
473
476
474
477
PQfinish (conn_new_template1 );
475
478
0 commit comments