]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix for \g strdup error.
authorBruce Momjian <bruce@momjian.us>
Fri, 22 Nov 1996 06:45:14 +0000 (06:45 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 22 Nov 1996 06:45:14 +0000 (06:45 +0000)
src/bin/psql/psql.c

index e7c13ba2a7f74524fc0256c4a72712af66780859..8b22ecf70cb7e36d505063067f2f3577b3821a03 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *    $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.31 1996/11/22 04:43:48 bryanh Exp $
+ *    $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.32 1996/11/22 06:45:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1099,7 +1099,12 @@ HandleSlashCmds(PsqlSettings * settings,
            break;
        }
     case 'g':                  /* \g means send query */
-       settings->gfname = strdup(optarg);
+       if (!optarg)
+           settings->gfname = NULL;
+       else if (!(settings->gfname = strdup(optarg))) {
+           perror("malloc");
+           exit(1);
+       }
        status = 0;
        break;
     case 'h':                  /* help */