From 14a85031b16239708d4f208528709153779c590d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 29 Jun 2013 22:14:56 -0400 Subject: [PATCH] ecpg: Consistently use mm_strdup() mm_strdup() is provided to check errors from strdup(), but some places were failing to use it. --- src/interfaces/ecpg/preproc/ecpg.addons | 4 ++-- src/interfaces/ecpg/preproc/ecpg.c | 4 ++-- src/interfaces/ecpg/preproc/ecpg.trailer | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons index 85ec391988..0682287c76 100644 --- a/src/interfaces/ecpg/preproc/ecpg.addons +++ b/src/interfaces/ecpg/preproc/ecpg.addons @@ -377,9 +377,9 @@ ECPG: opt_array_boundsopt_array_bounds'['']' block $$.index1 = $1.index1; $$.index2 = $1.index2; if (strcmp($1.index1, "-1") == 0) - $$.index1 = strdup($3); + $$.index1 = mm_strdup($3); else if (strcmp($1.index2, "-1") == 0) - $$.index2 = strdup($3); + $$.index2 = mm_strdup($3); $$.str = cat_str(4, $1.str, mm_strdup("["), $3, mm_strdup("]")); } ECPG: opt_array_bounds diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 7b2634d147..bbea3e1040 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -171,7 +171,7 @@ main(int argc, char *const argv[]) regression_mode = true; break; case 'o': - output_filename = strdup(optarg); + output_filename = mm_strdup(optarg); if (strcmp(output_filename, "-") == 0) yyout = stdout; else @@ -320,7 +320,7 @@ main(int argc, char *const argv[]) yyout = stdout; else { - output_filename = strdup(input_filename); + output_filename = mm_strdup(input_filename); ptr2ext = strrchr(output_filename, '.'); /* make extension = .c resp. .h */ diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 8258ce2f7d..58155ab660 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1428,13 +1428,13 @@ action : CONTINUE_P | SQL_GOTO name { $$.code = W_GOTO; - $$.command = strdup($2); + $$.command = mm_strdup($2); $$.str = cat2_str(mm_strdup("goto "), $2); } | SQL_GO TO name { $$.code = W_GOTO; - $$.command = strdup($3); + $$.command = mm_strdup($3); $$.str = cat2_str(mm_strdup("goto "), $3); } | DO name '(' c_args ')'