diff options
Diffstat (limited to 'src/backend/commands/variable.c')
-rw-r--r-- | src/backend/commands/variable.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index e555fb31501..791bac6715c 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -148,7 +148,7 @@ check_datestyle(char **newval, void **extra, GucSource source) char *subval; void *subextra = NULL; - subval = strdup(GetConfigOptionResetString("datestyle")); + subval = guc_strdup(LOG, GetConfigOptionResetString("datestyle")); if (!subval) { ok = false; @@ -156,7 +156,7 @@ check_datestyle(char **newval, void **extra, GucSource source) } if (!check_datestyle(&subval, &subextra, source)) { - free(subval); + guc_free(subval); ok = false; break; } @@ -165,8 +165,8 @@ check_datestyle(char **newval, void **extra, GucSource source) newDateStyle = myextra[0]; if (!have_order) newDateOrder = myextra[1]; - free(subval); - free(subextra); + guc_free(subval); + guc_free(subextra); } else { @@ -187,9 +187,9 @@ check_datestyle(char **newval, void **extra, GucSource source) } /* - * Prepare the canonical string to return. GUC wants it malloc'd. + * Prepare the canonical string to return. GUC wants it guc_malloc'd. */ - result = (char *) malloc(32); + result = (char *) guc_malloc(LOG, 32); if (!result) return false; @@ -221,13 +221,13 @@ check_datestyle(char **newval, void **extra, GucSource source) break; } - free(*newval); + guc_free(*newval); *newval = result; /* * Set up the "extra" struct actually used by assign_datestyle. */ - myextra = (int *) malloc(2 * sizeof(int)); + myextra = (int *) guc_malloc(LOG, 2 * sizeof(int)); if (!myextra) return false; myextra[0] = newDateStyle; @@ -366,7 +366,7 @@ check_timezone(char **newval, void **extra, GucSource source) /* * Pass back data for assign_timezone to use */ - *extra = malloc(sizeof(pg_tz *)); + *extra = guc_malloc(LOG, sizeof(pg_tz *)); if (!*extra) return false; *((pg_tz **) *extra) = new_tz; @@ -439,7 +439,7 @@ check_log_timezone(char **newval, void **extra, GucSource source) /* * Pass back data for assign_log_timezone to use */ - *extra = malloc(sizeof(pg_tz *)); + *extra = guc_malloc(LOG, sizeof(pg_tz *)); if (!*extra) return false; *((pg_tz **) *extra) = new_tz; @@ -500,7 +500,7 @@ check_timezone_abbreviations(char **newval, void **extra, GucSource source) return true; } - /* OK, load the file and produce a malloc'd TimeZoneAbbrevTable */ + /* OK, load the file and produce a guc_malloc'd TimeZoneAbbrevTable */ *extra = load_tzoffsets(*newval); /* tzparser.c returns NULL on failure, reporting via GUC_check_errmsg */ @@ -647,7 +647,7 @@ check_transaction_deferrable(bool *newval, void **extra, GucSource source) bool check_random_seed(double *newval, void **extra, GucSource source) { - *extra = malloc(sizeof(int)); + *extra = guc_malloc(LOG, sizeof(int)); if (!*extra) return false; /* Arm the assign only if source of value is an interactive SET */ @@ -735,8 +735,8 @@ check_client_encoding(char **newval, void **extra, GucSource source) if (strcmp(*newval, canonical_name) != 0 && strcmp(*newval, "UNICODE") != 0) { - free(*newval); - *newval = strdup(canonical_name); + guc_free(*newval); + *newval = guc_strdup(LOG, canonical_name); if (!*newval) return false; } @@ -744,7 +744,7 @@ check_client_encoding(char **newval, void **extra, GucSource source) /* * Save the encoding's ID in *extra, for use by assign_client_encoding. */ - *extra = malloc(sizeof(int)); + *extra = guc_malloc(LOG, sizeof(int)); if (!*extra) return false; *((int *) *extra) = encoding; @@ -847,7 +847,7 @@ check_session_authorization(char **newval, void **extra, GucSource source) ReleaseSysCache(roleTup); /* Set up "extra" struct for assign_session_authorization to use */ - myextra = (role_auth_extra *) malloc(sizeof(role_auth_extra)); + myextra = (role_auth_extra *) guc_malloc(LOG, sizeof(role_auth_extra)); if (!myextra) return false; myextra->roleid = roleid; @@ -957,7 +957,7 @@ check_role(char **newval, void **extra, GucSource source) } /* Set up "extra" struct for assign_role to use */ - myextra = (role_auth_extra *) malloc(sizeof(role_auth_extra)); + myextra = (role_auth_extra *) guc_malloc(LOG, sizeof(role_auth_extra)); if (!myextra) return false; myextra->roleid = roleid; |