diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-11-25 15:16:49 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-11-25 15:17:16 -0500 |
commit | d934a052348c1fa017ff677d08e74c643e3f416c (patch) | |
tree | 65b3c4d06c24e8c6dbbd3aaaa2d3de8fbd8ec736 /src | |
parent | aedccb1f6fef988af1d1a25b78151f3773954b4c (diff) | |
download | postgresql-d934a052348c1fa017ff677d08e74c643e3f416c.tar.gz postgresql-d934a052348c1fa017ff677d08e74c643e3f416c.zip |
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.)
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/misc/guc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f04757c5826..6b4db305e58 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -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,7 +8760,8 @@ SerializeGUCState(Size maxsize, char *start_address) else serialize_variable(&curptr, &bytes_left, guc_variables[i]); } - serialize_variable(&curptr, &bytes_left, guc_variables[i_role]); + if (i_role >= 0) + serialize_variable(&curptr, &bytes_left, guc_variables[i_role]); /* Store actual size without assuming alignment of start_address. */ actual_size = maxsize - bytes_left - sizeof(actual_size); |