From: Bruce Momjian Date: Mon, 14 Jul 1997 22:08:56 +0000 (+0000) Subject: Prevent psql optarg free-ing X-Git-Tag: REL6_1_1~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5eb4fadeaa414be90465faac2b6bd0d31814df32;p=postgresql Prevent psql optarg free-ing --- diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c index 1782a07fe8..469d3ea259 100644 --- a/src/bin/psql/psql.c +++ b/src/bin/psql/psql.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.76 1997/06/29 17:29:28 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.77 1997/07/14 22:08:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1641,7 +1641,7 @@ main(int argc, char **argv) fe_setauthsvc(optarg, errbuf); break; case 'c': - singleQuery = optarg; + singleQuery = strdup(optarg); if (singleQuery[0] == '\\') { singleSlashCmd = 1; } @@ -1656,7 +1656,7 @@ main(int argc, char **argv) qfilename = optarg; break; case 'F': - settings.opt.fieldSep = optarg; + settings.opt.fieldSep = strdup(optarg); break; case 'l': listDatabases = 1; @@ -1689,7 +1689,7 @@ main(int argc, char **argv) settings.opt.header = 0; break; case 'T': - settings.opt.tableOpt = optarg; + settings.opt.tableOpt = strdup(optarg); break; case 'u': settings.getPassword = 1; @@ -1759,8 +1759,7 @@ main(int argc, char **argv) sprintf(line, "\\i %s", qfilename); } HandleSlashCmds(&settings, line, ""); - if (!singleSlashCmd) free (line); /* PURIFY */ - + free (line); /* PURIFY */ } else { if (singleQuery) { bool success; /* The query succeeded at the backend */