aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2023-03-31 12:13:05 +1300
committerDavid Rowley <drowley@postgresql.org>2023-03-31 12:13:05 +1300
commit6c3b697b19db6274da622cf0fe7a7ad32eeeced3 (patch)
tree9bf18f7463d3d61e9f6192e26729793d9fe42c53 /src/backend/utils/adt/pgstatfuncs.c
parent11c2d6fdf5af1aacec9ca2005543f1b0fc4cc364 (diff)
downloadpostgresql-6c3b697b19db6274da622cf0fe7a7ad32eeeced3.tar.gz
postgresql-6c3b697b19db6274da622cf0fe7a7ad32eeeced3.zip
Fix List memory issue in transformColumnDefinition
When calling generateSerialExtraStmts(), we would pass in the constraint->options. In some cases, generateSerialExtraStmts() would modify the referenced List to remove elements from it, but doing so is invalid without assigning the list back to all variables that point to it. In the particular reported problem case, the List became empty, in which cases it became NIL, but the passed in constraint->options didn't get to find 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 the list, however, that seems less robust. Let's make sure the generated CreateSeqStmt gets a completely different copy of the list to be safe. Bug: #17879 Reported-by: Fei Changhong Diagnosed-by: Fei Changhong Discussion: https://postgr.es/m/17879-b7dfb5debee58ff5@postgresql.org Backpatch-through: 11, all supported versions
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions