diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index b4f5f5e7d1ad4fcb50e574be2880a3873ee9dcef..53efd7d1a80fb95c9214e74e9b3ab57a1033b094 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -697,10 +697,10 @@ read_post_opts(void) if ((arg1 = strstr(optline, " \"")) != NULL) { *arg1 = '\0'; /* terminate so we get only program name */ - post_opts = arg1 + 1; /* point past whitespace */ + post_opts = strdup(arg1 + 1); /* point past whitespace */ } if (postgres_path == NULL) - postgres_path = optline; + postgres_path = strdup(optline); } /* Free the results of readfile. */