summaryrefslogtreecommitdiff
path: root/src/bin/pg_upgrade/parallel.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-06-17 11:51:38 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-07-03 09:05:34 +0200
commit098c703d308fa88dc9e3f9f623ca023ce4717794 (patch)
tree81e03668d6fc6ea832f16996da78e3483beef4f7 /src/bin/pg_upgrade/parallel.c
parente2bc242833da27cd73c279bebfb321a65384808f (diff)
Remove redundant null pointer checks before pg_free()
These are especially useless because the whole point of pg_free() was to do that very check before calling free(). pg_free() could be removed altogether, but I'm keeping it here to keep the API consistent. Discussion: https://www.postgresql.org/message-id/flat/dac5d2d0-98f5-94d9-8e69-46da2413593d%40enterprisedb.com
Diffstat (limited to 'src/bin/pg_upgrade/parallel.c')
-rw-r--r--src/bin/pg_upgrade/parallel.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/bin/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c
index ca40df7b4c7..5a3df84f019 100644
--- a/src/bin/pg_upgrade/parallel.c
+++ b/src/bin/pg_upgrade/parallel.c
@@ -130,14 +130,11 @@ parallel_exec_prog(const char *log_file, const char *opt_log_file,
new_arg = exec_thread_args[parallel_jobs - 1];
/* Can only pass one pointer into the function, so use a struct */
- if (new_arg->log_file)
- pg_free(new_arg->log_file);
+ pg_free(new_arg->log_file);
new_arg->log_file = pg_strdup(log_file);
- if (new_arg->opt_log_file)
- pg_free(new_arg->opt_log_file);
+ pg_free(new_arg->opt_log_file);
new_arg->opt_log_file = opt_log_file ? pg_strdup(opt_log_file) : NULL;
- if (new_arg->cmd)
- pg_free(new_arg->cmd);
+ pg_free(new_arg->cmd);
new_arg->cmd = pg_strdup(cmd);
child = (HANDLE) _beginthreadex(NULL, 0, (void *) win32_exec_prog,
@@ -243,14 +240,11 @@ parallel_transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
/* Can only pass one pointer into the function, so use a struct */
new_arg->old_db_arr = old_db_arr;
new_arg->new_db_arr = new_db_arr;
- if (new_arg->old_pgdata)
- pg_free(new_arg->old_pgdata);
+ pg_free(new_arg->old_pgdata);
new_arg->old_pgdata = pg_strdup(old_pgdata);
- if (new_arg->new_pgdata)
- pg_free(new_arg->new_pgdata);
+ pg_free(new_arg->new_pgdata);
new_arg->new_pgdata = pg_strdup(new_pgdata);
- if (new_arg->old_tablespace)
- pg_free(new_arg->old_tablespace);
+ pg_free(new_arg->old_tablespace);
new_arg->old_tablespace = old_tablespace ? pg_strdup(old_tablespace) : NULL;
child = (HANDLE) _beginthreadex(NULL, 0, (void *) win32_transfer_all_new_dbs,