Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6c3b697

Browse files
committed
Fix List memory issue in transformColumnDefinition
When calling generateSerialExtraStmts(), we would pass in theconstraint->options. In some cases, generateSerialExtraStmts() wouldmodify the referenced List to remove elements from it, but doing so isinvalid without assigning the list back to all variables that point to it.In the particular reported problem case, the List became empty, in whichcases it became NIL, but the passed in constraint->options didn't get tofind out about that and was left pointing to free'd memory.To fix this, just perform a list_copy() inside generateSerialExtraStmts().We could just do a list_copy() just before we perform the delete from thelist, however, that seems less robust. Let's make sure the generatedCreateSeqStmt gets a completely different copy of the list to be safe.Bug: #17879Reported-by: Fei ChanghongDiagnosed-by: Fei ChanghongDiscussion:https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.orgBackpatch-through: 11, all supported versions
1 parent11c2d6f commit6c3b697

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/parser/parse_utilcmd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column,
381381
List*attnamelist;
382382
intnameEl_idx=-1;
383383

384+
/* Make a copy of this as we may end up modifying it in the code below */
385+
seqoptions=list_copy(seqoptions);
386+
384387
/*
385388
* Determine namespace and name to use for the sequence.
386389
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp