mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Fix uninitialized-variable warning.
In passing, add an Assert defending the presumption that bytes_left is positive to start with. (I'm not exactly convinced that using an unsigned type was such a bright thing here, but let's at least do this much.)
This commit is contained in:
parent
aedccb1f6f
commit
d934a05234
@ -8741,9 +8741,10 @@ SerializeGUCState(Size maxsize, char *start_address)
|
||||
Size actual_size;
|
||||
Size bytes_left;
|
||||
int i;
|
||||
int i_role;
|
||||
int i_role = -1;
|
||||
|
||||
/* Reserve space for saving the actual size of the guc state */
|
||||
Assert(maxsize > sizeof(actual_size));
|
||||
curptr = start_address + sizeof(actual_size);
|
||||
bytes_left = maxsize - sizeof(actual_size);
|
||||
|
||||
@ -8759,6 +8760,7 @@ SerializeGUCState(Size maxsize, char *start_address)
|
||||
else
|
||||
serialize_variable(&curptr, &bytes_left, guc_variables[i]);
|
||||
}
|
||||
if (i_role >= 0)
|
||||
serialize_variable(&curptr, &bytes_left, guc_variables[i_role]);
|
||||
|
||||
/* Store actual size without assuming alignment of start_address. */
|
||||
|
Loading…
Reference in New Issue
Block a user