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
faea3db9
Commit
faea3db9
authored
Jul 13, 2005
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix libpq memory leak during PQreset() --- closePGconn() was not
freeing all transient state of the PGconn object.
parent
5d0a43c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+30
-2
No files found.
src/interfaces/libpq/fe-connect.c
View file @
faea3db9
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.31
3 2005/06/27 02:04:26 neilc
Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.31
4 2005/07/13 15:25:55 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1874,6 +1874,8 @@ makeEmptyPGconn(void)
/*
* freePGconn
* - free the PGconn data structure
*
* When changing/adding to this function, see also closePGconn!
*/
static
void
freePGconn
(
PGconn
*
conn
)
...
...
@@ -1921,6 +1923,7 @@ freePGconn(PGconn *conn)
free
(
conn
->
krbsrvname
);
#endif
/* Note that conn->Pfdebug is not ours to close or free */
freeaddrinfo_all
(
conn
->
addrlist_family
,
conn
->
addrlist
);
notify
=
conn
->
notifyHead
;
while
(
notify
!=
NULL
)
{
...
...
@@ -1929,7 +1932,6 @@ freePGconn(PGconn *conn)
notify
=
notify
->
next
;
free
(
prev
);
}
freeaddrinfo_all
(
conn
->
addrlist_family
,
conn
->
addrlist
);
pstatus
=
conn
->
pstatus
;
while
(
pstatus
!=
NULL
)
{
...
...
@@ -1952,10 +1954,15 @@ freePGconn(PGconn *conn)
/*
* closePGconn
* - properly close a connection to the backend
*
* Release all transient state, but NOT the connection parameters.
*/
static
void
closePGconn
(
PGconn
*
conn
)
{
PGnotify
*
notify
;
pgParameterStatus
*
pstatus
;
/*
* Note that the protocol doesn't allow us to send Terminate messages
* during the startup phase.
...
...
@@ -1991,6 +1998,27 @@ closePGconn(PGconn *conn)
* absent */
conn
->
asyncStatus
=
PGASYNC_IDLE
;
pqClearAsyncResult
(
conn
);
/* deallocate result and curTuple */
freeaddrinfo_all
(
conn
->
addrlist_family
,
conn
->
addrlist
);
conn
->
addrlist
=
NULL
;
conn
->
addr_cur
=
NULL
;
notify
=
conn
->
notifyHead
;
while
(
notify
!=
NULL
)
{
PGnotify
*
prev
=
notify
;
notify
=
notify
->
next
;
free
(
prev
);
}
conn
->
notifyHead
=
NULL
;
pstatus
=
conn
->
pstatus
;
while
(
pstatus
!=
NULL
)
{
pgParameterStatus
*
prev
=
pstatus
;
pstatus
=
pstatus
->
next
;
free
(
prev
);
}
conn
->
pstatus
=
NULL
;
if
(
conn
->
lobjfuncs
)
free
(
conn
->
lobjfuncs
);
conn
->
lobjfuncs
=
NULL
;
...
...
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