mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Change the way string relopts are allocated.
Don't try to allocate the default value for a string relopt in the same palloc chunk as the relopt_string struct. That didn't work too well if you added a built-in string relopt in the stringRelOpts array, as it's not possible to have an initializer for a variable length struct in C. This makes the code slightly simpler too. While we're at it, move the call to validator function in add_string_reloption to before the allocation, so that if someone does pass a bogus default value, we don't leak memory.
This commit is contained in:
@@ -108,7 +108,7 @@ typedef struct relopt_string
|
||||
int default_len;
|
||||
bool default_isnull;
|
||||
validate_string_relopt validate_cb;
|
||||
char default_val[1]; /* variable length, zero-terminated */
|
||||
char *default_val;
|
||||
} relopt_string;
|
||||
|
||||
/* This is the table datatype for fillRelOptions */
|
||||
|
||||
Reference in New Issue
Block a user