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:
Dan Farina
2010-12-10 12:50:52 -08:00
committed by Peter van Hardenberg
parent 3f2094a242
commit 6cea339697

View File

@@ -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;
}