aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/pg_locale.c30
-rw-r--r--src/backend/utils/error/elog.c3
-rw-r--r--src/backend/utils/init/miscinit.c3
-rw-r--r--src/backend/utils/misc/guc.c24
4 files changed, 20 insertions, 40 deletions
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index a0490a75224..ea42e70e43b 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -374,26 +374,16 @@ assign_locale_messages(const char *newval, void *extra)
static void
free_struct_lconv(struct lconv *s)
{
- if (s->decimal_point)
- free(s->decimal_point);
- if (s->thousands_sep)
- free(s->thousands_sep);
- if (s->grouping)
- free(s->grouping);
- if (s->int_curr_symbol)
- free(s->int_curr_symbol);
- if (s->currency_symbol)
- free(s->currency_symbol);
- if (s->mon_decimal_point)
- free(s->mon_decimal_point);
- if (s->mon_thousands_sep)
- free(s->mon_thousands_sep);
- if (s->mon_grouping)
- free(s->mon_grouping);
- if (s->positive_sign)
- free(s->positive_sign);
- if (s->negative_sign)
- free(s->negative_sign);
+ free(s->decimal_point);
+ free(s->thousands_sep);
+ free(s->grouping);
+ free(s->int_curr_symbol);
+ free(s->currency_symbol);
+ free(s->mon_decimal_point);
+ free(s->mon_thousands_sep);
+ free(s->mon_grouping);
+ free(s->positive_sign);
+ free(s->negative_sign);
}
/*
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 55ee5423afb..59124bd9ccb 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -1985,8 +1985,7 @@ set_syslog_parameters(const char *ident, int facility)
closelog();
openlog_done = false;
}
- if (syslog_ident)
- free(syslog_ident);
+ free(syslog_ident);
syslog_ident = strdup(ident);
/* if the strdup fails, we will cope in write_syslog() */
syslog_facility = facility;
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index b25bd0e5838..eb43b2c5e57 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -417,8 +417,7 @@ SetDataDir(const char *dir)
/* If presented path is relative, convert to absolute */
new = make_absolute_path(dir);
- if (DataDir)
- free(DataDir);
+ free(DataDir);
DataDir = new;
}
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index f640468f113..0328029d430 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -5483,8 +5483,7 @@ build_guc_variables(void)
for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
- if (guc_variables)
- free(guc_variables);
+ free(guc_variables);
guc_variables = guc_vars;
num_guc_variables = num_vars;
size_guc_variables = size_vars;
@@ -6880,8 +6879,7 @@ ReportGUCOption(struct config_generic *record)
* set last_reported to NULL and thereby possibly make a duplicate
* report later.
*/
- if (record->last_reported)
- free(record->last_reported);
+ free(record->last_reported);
record->last_reported = strdup(val);
}
@@ -8356,8 +8354,7 @@ set_config_sourcefile(const char *name, char *sourcefile, int sourceline)
return;
sourcefile = guc_strdup(elevel, sourcefile);
- if (record->sourcefile)
- free(record->sourcefile);
+ free(record->sourcefile);
record->sourcefile = sourcefile;
record->sourceline = sourceline;
}
@@ -8877,8 +8874,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt)
if (record->vartype == PGC_STRING && newval.stringval != NULL)
free(newval.stringval);
- if (newextra)
- free(newextra);
+ free(newextra);
/*
* We must also reject values containing newlines, because the
@@ -11225,12 +11221,9 @@ RestoreGUCState(void *gucstate)
* pointers.
*/
Assert(gconf->stack == NULL);
- if (gconf->extra)
- free(gconf->extra);
- if (gconf->last_reported) /* probably can't happen */
- free(gconf->last_reported);
- if (gconf->sourcefile)
- free(gconf->sourcefile);
+ free(gconf->extra);
+ free(gconf->last_reported);
+ free(gconf->sourcefile);
switch (gconf->vartype)
{
case PGC_BOOL:
@@ -11261,8 +11254,7 @@ RestoreGUCState(void *gucstate)
{
struct config_string *conf = (struct config_string *) gconf;
- if (*conf->variable)
- free(*conf->variable);
+ free(*conf->variable);
if (conf->reset_val && conf->reset_val != *conf->variable)
free(conf->reset_val);
if (conf->reset_extra && conf->reset_extra != gconf->extra)