aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/parser.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-11-27 12:44:03 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2024-11-27 12:50:23 -0500
commit85312d95e959bae16c5d0bbf79ae74bcd7fec1a9 (patch)
tree33257a71f6da4288446edffbac48953561f7fa06 /src/interfaces/ecpg/preproc/parser.c
parent0e6060790d6533847084770845c84e81862bff47 (diff)
downloadpostgresql-85312d95e959bae16c5d0bbf79ae74bcd7fec1a9.tar.gz
postgresql-85312d95e959bae16c5d0bbf79ae74bcd7fec1a9.zip
ecpg: put all string-valued tokens returned by pgc.l in local storage.
This didn't work earlier in the patch series (I think some of the strings were ending up in data-type-related structures), but apparently we're now clean enough for it. This considerably reduces process-lifespan memory leakage. Discussion: https://postgr.es/m/2011420.1713493114@sss.pgh.pa.us
Diffstat (limited to 'src/interfaces/ecpg/preproc/parser.c')
-rw-r--r--src/interfaces/ecpg/preproc/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/parser.c b/src/interfaces/ecpg/preproc/parser.c
index 373c93fc04a..181417fb39c 100644
--- a/src/interfaces/ecpg/preproc/parser.c
+++ b/src/interfaces/ecpg/preproc/parser.c
@@ -203,7 +203,9 @@ filtered_base_yylex(void)
base_yytext = cur_yytext;
/* Combine 3 tokens into 1 */
- base_yylval.str = psprintf("%s UESCAPE %s", base_yylval.str, escstr);
+ base_yylval.str = make3_str(base_yylval.str,
+ " UESCAPE ",
+ escstr);
base_yylloc = loc_strdup(base_yylval.str);
/* Clear have_lookahead, thereby consuming all three tokens */