ecpg: Consistently use mm_strdup()

mm_strdup() is provided to check errors from strdup(), but some places
were failing to use it.
This commit is contained in:
Peter Eisentraut 2013-06-29 22:14:56 -04:00
parent ee6556555b
commit 14a85031b1
3 changed files with 6 additions and 6 deletions

View File

@ -377,9 +377,9 @@ ECPG: opt_array_boundsopt_array_bounds'['']' block
$$.index1 = $1.index1; $$.index1 = $1.index1;
$$.index2 = $1.index2; $$.index2 = $1.index2;
if (strcmp($1.index1, "-1") == 0) if (strcmp($1.index1, "-1") == 0)
$$.index1 = strdup($3); $$.index1 = mm_strdup($3);
else if (strcmp($1.index2, "-1") == 0) 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("]")); $$.str = cat_str(4, $1.str, mm_strdup("["), $3, mm_strdup("]"));
} }
ECPG: opt_array_bounds ECPG: opt_array_bounds

View File

@ -171,7 +171,7 @@ main(int argc, char *const argv[])
regression_mode = true; regression_mode = true;
break; break;
case 'o': case 'o':
output_filename = strdup(optarg); output_filename = mm_strdup(optarg);
if (strcmp(output_filename, "-") == 0) if (strcmp(output_filename, "-") == 0)
yyout = stdout; yyout = stdout;
else else
@ -320,7 +320,7 @@ main(int argc, char *const argv[])
yyout = stdout; yyout = stdout;
else else
{ {
output_filename = strdup(input_filename); output_filename = mm_strdup(input_filename);
ptr2ext = strrchr(output_filename, '.'); ptr2ext = strrchr(output_filename, '.');
/* make extension = .c resp. .h */ /* make extension = .c resp. .h */

View File

@ -1428,13 +1428,13 @@ action : CONTINUE_P
| SQL_GOTO name | SQL_GOTO name
{ {
$<action>$.code = W_GOTO; $<action>$.code = W_GOTO;
$<action>$.command = strdup($2); $<action>$.command = mm_strdup($2);
$<action>$.str = cat2_str(mm_strdup("goto "), $2); $<action>$.str = cat2_str(mm_strdup("goto "), $2);
} }
| SQL_GO TO name | SQL_GO TO name
{ {
$<action>$.code = W_GOTO; $<action>$.code = W_GOTO;
$<action>$.command = strdup($3); $<action>$.command = mm_strdup($3);
$<action>$.str = cat2_str(mm_strdup("goto "), $3); $<action>$.str = cat2_str(mm_strdup("goto "), $3);
} }
| DO name '(' c_args ')' | DO name '(' c_args ')'