8000 ecpg: Consistently use mm_strdup() · akilasithum/postgres@14a8503 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14a8503

Browse files
committed
ecpg: Consistently use mm_strdup()
mm_strdup() is provided to check errors from strdup(), but some places were failing to use it.
1 parent ee65565 commit 14a8503

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/interfaces/ecpg/preproc/ecpg.addons

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,9 @@ ECPG: opt_array_boundsopt_array_bounds'['']' block
377377
$$.index1 = $1.index1;
378378
$$.index2 = $1.index2;
379379
if (strcmp($1.index1, "-1") == 0)
380-
$$.index1 = strdup($3);
380+
$$.index1 = mm_strdup($3);
381381
else if (strcmp($1.index2, "-1") == 0)
382-
$$.index2 = strdup($3);
382+
$$.index2 = mm_strdup($3);
383383
$$.str = cat_str(4, $1.str, mm_strdup("["), $3, mm_strdup("]"));
384384
}
385385
ECPG: opt_array_bounds

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ main(int argc, char *const argv[])
171171
regression_mode = true;
172172
break;
173173
case 'o':
174-
output_filename = strdup(optarg);
174+
output_filename = mm_strdup(optarg);
175175
if (strcmp(output_filename, "-") == 0)
176176
yyout = stdout;
177177
else
@@ -320,7 +320,7 @@ main(int argc, char *const argv[])
320320
yyout = stdout;
321321
else
322322
{
323-
output_filename = strdup(input_filename);
323+
output_filename = mm_strdup(input_filename);
324324

325325
ptr2ext = strrchr(output_filename, '.');
326326
/* make extension = .c resp. .h */

src/interfaces/ecpg/preproc/ecpg.trailer

Lines changed: 2 additions & 2 deletions
1431
Original file line numberDiff line numberDiff line change
@@ -1428,13 +1428,13 @@ action : CONTINUE_P
14281428
| SQL_GOTO name
14291429
{
14301430
$<action>$.code = W_GOTO;
-
$<action>$.command = strdup($2);
1431+
$<action>$.command = mm_strdup($2);
14321432
$<action>$.str = cat2_str(mm_strdup("goto "), $2);
14331433
}
14341434
| SQL_GO TO name
14351435
{
14361436
$<action>$.code = W_GOTO;
1437-
$<action>$.command = strdup($3);
1437+
$<action>$.command = mm_strdup($3);
14381438
$<action>$.str = cat2_str(mm_strdup("goto "), $3);
14391439
}
14401440
| DO name '(' c_args ')'

0 commit comments

Comments
 (0)
0