@@ -383,7 +383,6 @@ set_locale_and_encoding(void)
383
383
char * datcollate_literal ;
384
384
char * datctype_literal ;
385
385
char * daticulocale_literal = NULL ;
386
- char * daticulocale_src ;
387
386
DbLocaleInfo * locale = old_cluster .template0 ;
388
387
389
388
prep_status ("Setting locale and encoding for new cluster" );
@@ -397,10 +396,13 @@ set_locale_and_encoding(void)
397
396
datctype_literal = PQescapeLiteral (conn_new_template1 ,
398
397
locale -> db_ctype ,
399
398
strlen (locale -> db_ctype ));
400
- daticulocale_src = locale -> db_iculocale ? locale -> db_iculocale : "NULL" ;
401
- daticulocale_literal = PQescapeLiteral (conn_new_template1 ,
402
- daticulocale_src ,
403
- strlen (daticulocale_src ));
399
+
400
+ if (locale -> db_iculocale )
401
+ daticulocale_literal = PQescapeLiteral (conn_new_template1 ,
402
+ locale -> db_iculocale ,
403
+ strlen (locale -> db_iculocale ));
404
+ else
405
+ daticulocale_literal = "NULL" ;
404
406
405
407
/* update template0 in new cluster */
406
408
if (GET_MAJOR_VERSION (new_cluster .major_version ) >= 1500 )
@@ -430,7 +432,8 @@ set_locale_and_encoding(void)
430
432
431
433
PQfreemem (datcollate_literal );
432
434
PQfreemem (datctype_literal );
433
- PQfreemem (daticulocale_literal );
435
+ if (locale -> db_iculocale )
436
+ PQfreemem (daticulocale_literal );
434
437
435
438
PQfinish (conn_new_template1 );
436
439
0 commit comments