aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/libpq/fe-connect.c')
-rw-r--r--src/interfaces/libpq/fe-connect.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 6d8198ac0e7..13c407d1cc1 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.344 2007/02/20 15:20:51 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.345 2007/03/08 19:27:28 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1840,9 +1840,7 @@ makeEmptyPGconn(void)
#ifdef WIN32
/*
- * Make sure socket support is up and running. Even though this is done in
- * libpqdll.c, that is only for MSVC and BCC builds and doesn't work for
- * static builds at all, so we have to do it in the main code too.
+ * Make sure socket support is up and running.
*/
WSADATA wsaData;
@@ -1853,7 +1851,12 @@ makeEmptyPGconn(void)
conn = (PGconn *) malloc(sizeof(PGconn));
if (conn == NULL)
+ {
+#ifdef WIN32
+ WSACleanup();
+#endif
return conn;
+ }
/* Zero all pointers and booleans */
MemSet(conn, 0, sizeof(PGconn));
@@ -1918,10 +1921,6 @@ freePGconn(PGconn *conn)
PGnotify *notify;
pgParameterStatus *pstatus;
-#ifdef WIN32
- WSACleanup();
-#endif
-
if (!conn)
return;
@@ -1986,6 +1985,10 @@ freePGconn(PGconn *conn)
termPQExpBuffer(&conn->errorMessage);
termPQExpBuffer(&conn->workBuffer);
free(conn);
+
+#ifdef WIN32
+ WSACleanup();
+#endif
}
/*