Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
aa158a74
Commit
aa158a74
authored
26 years ago
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak from Tom Lane.
parent
3ac9688a
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+4
-4
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-misc.c
+35
-4
No files found.
src/interfaces/libpq/fe-connect.c
View file @
aa158a74
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.8
2 1998/09/18 16:46:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.8
3 1998/09/20 04:51:10
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1316,9 +1316,8 @@ conninfo_parse(const char *conninfo, char *errorMessage)
*/
if
(
!
strcmp
(
option
->
keyword
,
"user"
))
{
tmp
=
fe_getauthname
(
errortmp
);
if
(
tmp
)
option
->
val
=
strdup
(
tmp
);
option
->
val
=
fe_getauthname
(
errortmp
);
continue
;
}
/* ----------
...
...
@@ -1330,6 +1329,7 @@ conninfo_parse(const char *conninfo, char *errorMessage)
tmp
=
conninfo_getval
(
"user"
);
if
(
tmp
)
option
->
val
=
strdup
(
tmp
);
continue
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/fe-misc.c
View file @
aa158a74
...
...
@@ -24,7 +24,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.2
1 1998/09/03 02:10:50
momjian Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.2
2 1998/09/20 04:51:12
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -366,6 +366,11 @@ tryAgain:
#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
if
(
errno
==
EWOULDBLOCK
)
return
0
;
#endif
/* We might get ECONNRESET here if using TCP and backend died */
#ifdef ECONNRESET
if
(
errno
==
ECONNRESET
)
goto
definitelyFailed
;
#endif
sprintf
(
conn
->
errorMessage
,
"pqReadData() -- read() failed: errno=%d
\n
%s
\n
"
,
...
...
@@ -409,6 +414,11 @@ tryAgain2:
#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
if
(
errno
==
EWOULDBLOCK
)
return
0
;
#endif
/* We might get ECONNRESET here if using TCP and backend died */
#ifdef ECONNRESET
if
(
errno
==
ECONNRESET
)
goto
definitelyFailed
;
#endif
sprintf
(
conn
->
errorMessage
,
"pqReadData() -- read() failed: errno=%d
\n
%s
\n
"
,
...
...
@@ -425,6 +435,7 @@ tryAgain2:
* OK, we are getting a zero read even though select() says ready.
* This means the connection has been closed. Cope.
*/
definitelyFailed:
sprintf
(
conn
->
errorMessage
,
"pqReadData() -- backend closed the channel unexpectedly.
\n
"
"
\t
This probably means the backend terminated abnormally"
...
...
@@ -460,7 +471,6 @@ pqFlush(PGconn *conn)
/* Prevent being SIGPIPEd if backend has closed the connection. */
#ifndef WIN32
pqsigfunc
oldsighandler
=
pqsignal
(
SIGPIPE
,
SIG_IGN
);
#endif
int
sent
=
send
(
conn
->
sock
,
ptr
,
len
,
0
);
...
...
@@ -471,7 +481,11 @@ pqFlush(PGconn *conn)
if
(
sent
<
0
)
{
/* Anything except EAGAIN or EWOULDBLOCK is trouble */
/*
* Anything except EAGAIN or EWOULDBLOCK is trouble.
* If it's EPIPE or ECONNRESET, assume we've lost the
* backend connection permanently.
*/
switch
(
errno
)
{
#ifdef EAGAIN
...
...
@@ -482,10 +496,27 @@ pqFlush(PGconn *conn)
case
EWOULDBLOCK
:
break
;
#endif
case
EPIPE
:
#ifdef ECONNRESET
case
ECONNRESET
:
#endif
sprintf
(
conn
->
errorMessage
,
"pqFlush() -- backend closed the channel unexpectedly.
\n
"
"
\t
This probably means the backend terminated abnormally"
" before or while processing the request.
\n
"
);
conn
->
status
=
CONNECTION_BAD
;
/* No more connection */
#ifdef WIN32
closesocket
(
conn
->
sock
);
#else
close
(
conn
->
sock
);
#endif
conn
->
sock
=
-
1
;
return
EOF
;
default:
sprintf
(
conn
->
errorMessage
,
"pqFlush() -- couldn't send data: errno=%d
\n
%s
\n
"
,
"pqFlush() -- couldn't send data: errno=%d
\n
%s
\n
"
,
errno
,
strerror
(
errno
));
/* We don't assume it's a fatal error... */
return
EOF
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment