Prevent psql optarg free-ing

This commit is contained in:
Bruce Momjian 1997-07-14 22:08:56 +00:00
parent 741b497f21
commit 5eb4fadeaa
1 changed files with 5 additions and 6 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); fe_setauthsvc(optarg, errbuf);
break; break;
case 'c': case 'c':
singleQuery = optarg; singleQuery = strdup(optarg);
if (singleQuery[0] == '\\') { if (singleQuery[0] == '\\') {
singleSlashCmd = 1; singleSlashCmd = 1;
} }
@ -1656,7 +1656,7 @@ main(int argc, char **argv)
qfilename = optarg; qfilename = optarg;
break; break;
case 'F': case 'F':
settings.opt.fieldSep = optarg; settings.opt.fieldSep = strdup(optarg);
break; break;
case 'l': case 'l':
listDatabases = 1; listDatabases = 1;
@ -1689,7 +1689,7 @@ main(int argc, char **argv)
settings.opt.header = 0; settings.opt.header = 0;
break; break;
case 'T': case 'T':
settings.opt.tableOpt = optarg; settings.opt.tableOpt = strdup(optarg);
break; break;
case 'u': case 'u':
settings.getPassword = 1; settings.getPassword = 1;
@ -1759,8 +1759,7 @@ main(int argc, char **argv)
sprintf(line, "\\i %s", qfilename); sprintf(line, "\\i %s", qfilename);
} }
HandleSlashCmds(&settings, line, ""); HandleSlashCmds(&settings, line, "");
if (!singleSlashCmd) free (line); /* PURIFY */ free (line); /* PURIFY */
} else { } else {
if (singleQuery) { if (singleQuery) {
bool success; /* The query succeeded at the backend */ bool success; /* The query succeeded at the backend */