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
78bfc22e
Commit
78bfc22e
authored
Jun 30, 2006
by
Alvaro Herrera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix use-after-free error reported by Neil Conway.
parent
569e32a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
src/bin/psql/common.c
src/bin/psql/common.c
+11
-9
No files found.
src/bin/psql/common.c
View file @
78bfc22e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.1
19 2006/06/14 16:49:02 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.1
20 2006/06/30 15:06:05 alvherre
Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
#include "common.h"
#include "common.h"
...
@@ -875,19 +875,19 @@ SendQuery(const char *query)
...
@@ -875,19 +875,19 @@ SendQuery(const char *query)
if
(
OK
)
if
(
OK
)
OK
=
PrintQueryResults
(
results
);
OK
=
PrintQueryResults
(
results
);
PQclear
(
results
);
/* If we made a temporary savepoint, possibly release/rollback */
/* If we made a temporary savepoint, possibly release/rollback */
if
(
on_error_rollback_savepoint
)
if
(
on_error_rollback_savepoint
)
{
{
PGresult
*
svptres
;
transaction_status
=
PQtransactionStatus
(
pset
.
db
);
transaction_status
=
PQtransactionStatus
(
pset
.
db
);
/* We always rollback on an error */
/* We always rollback on an error */
if
(
transaction_status
==
PQTRANS_INERROR
)
if
(
transaction_status
==
PQTRANS_INERROR
)
result
s
=
PQexec
(
pset
.
db
,
"ROLLBACK TO pg_psql_temporary_savepoint"
);
svptre
s
=
PQexec
(
pset
.
db
,
"ROLLBACK TO pg_psql_temporary_savepoint"
);
/* If they are no longer in a transaction, then do nothing */
/* If they are no longer in a transaction, then do nothing */
else
if
(
transaction_status
!=
PQTRANS_INTRANS
)
else
if
(
transaction_status
!=
PQTRANS_INTRANS
)
result
s
=
NULL
;
svptre
s
=
NULL
;
else
else
{
{
/*
/*
...
@@ -898,20 +898,22 @@ SendQuery(const char *query)
...
@@ -898,20 +898,22 @@ SendQuery(const char *query)
if
(
strcmp
(
PQcmdStatus
(
results
),
"SAVEPOINT"
)
==
0
||
if
(
strcmp
(
PQcmdStatus
(
results
),
"SAVEPOINT"
)
==
0
||
strcmp
(
PQcmdStatus
(
results
),
"RELEASE"
)
==
0
||
strcmp
(
PQcmdStatus
(
results
),
"RELEASE"
)
==
0
||
strcmp
(
PQcmdStatus
(
results
),
"ROLLBACK"
)
==
0
)
strcmp
(
PQcmdStatus
(
results
),
"ROLLBACK"
)
==
0
)
result
s
=
NULL
;
svptre
s
=
NULL
;
else
else
result
s
=
PQexec
(
pset
.
db
,
"RELEASE pg_psql_temporary_savepoint"
);
svptre
s
=
PQexec
(
pset
.
db
,
"RELEASE pg_psql_temporary_savepoint"
);
}
}
if
(
PQresultStatus
(
result
s
)
!=
PGRES_COMMAND_OK
)
if
(
svptres
&&
PQresultStatus
(
svptre
s
)
!=
PGRES_COMMAND_OK
)
{
{
psql_error
(
"%s"
,
PQerrorMessage
(
pset
.
db
));
psql_error
(
"%s"
,
PQerrorMessage
(
pset
.
db
));
PQclear
(
results
);
PQclear
(
results
);
PQclear
(
svptres
);
ResetCancelConn
();
ResetCancelConn
();
return
false
;
return
false
;
}
}
PQclear
(
results
);
}
}
PQclear
(
results
);
/* Possible microtiming output */
/* Possible microtiming output */
if
(
OK
&&
pset
.
timing
)
if
(
OK
&&
pset
.
timing
)
printf
(
_
(
"Time: %.3f ms
\n
"
),
DIFF_MSEC
(
&
after
,
&
before
));
printf
(
_
(
"Time: %.3f ms
\n
"
),
DIFF_MSEC
(
&
after
,
&
before
));
...
...
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