mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Fix a use-after-free
A result is being cleared while there are still pointers that refer to datums in it. Signed-off-by: Dan Farina <drfarina@acm.org> Signed-off-by: Peter van Hardenberg <pvh@heroku.com>
This commit is contained in:
committed by
Peter van Hardenberg
parent
3f2094a242
commit
6cea339697
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* dbutils.c
|
||||
*
|
||||
* Copyright (c) 2ndQuadrant, 2010
|
||||
* Copyright (c) Heroku, 2010
|
||||
*
|
||||
* Database connection/management functions
|
||||
*
|
||||
@@ -91,7 +93,6 @@ pg_version(PGconn *conn)
|
||||
|
||||
major_version1 = atoi(PQgetvalue(res, 0, 0));
|
||||
major_version2 = PQgetvalue(res, 0, 1);
|
||||
PQclear(res);
|
||||
|
||||
major_version = malloc(major_version_sz);
|
||||
|
||||
@@ -104,6 +105,8 @@ pg_version(PGconn *conn)
|
||||
else
|
||||
strcpy(major_version, "");
|
||||
|
||||
PQclear(res);
|
||||
|
||||
return major_version;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user