From 54847b25d4fe268cd46d9a9a166dbe6e971e5373 Mon Sep 17 00:00:00 2001
From: Michael Meskes <meskes@postgresql.org>
Date: Tue, 7 Dec 1999 10:29:18 +0000
Subject: [PATCH] *** empty log message ***

---
 src/interfaces/ecpg/ChangeLog       |  4 ++++
 src/interfaces/ecpg/lib/Makefile.in |  4 ++--
 src/interfaces/ecpg/lib/ecpglib.c   |  4 ++++
 src/interfaces/ecpg/test/test4.pgc  | 23 ++++++++++++++---------
 4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 4742b55bb1f..fcc28885792 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -726,3 +726,7 @@ Tue Nov 23 07:59:01 CET 1999
 	- Ignore locale setting in ECPGdo.
 	- Set library version to 3.0.7.
 
+Fri Dec  3 16:35:07 CET 1999
+
+	- Fixed memory leak in ecpglib.
+	- Set library version to 3.0.8.
diff --git a/src/interfaces/ecpg/lib/Makefile.in b/src/interfaces/ecpg/lib/Makefile.in
index 00265d9443f..ed3df4625a4 100644
--- a/src/interfaces/ecpg/lib/Makefile.in
+++ b/src/interfaces/ecpg/lib/Makefile.in
@@ -6,13 +6,13 @@
 # Copyright (c) 1994, Regents of the University of California
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.52 1999/11/23 10:32:16 meskes Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/Makefile.in,v 1.53 1999/12/07 10:29:16 meskes Exp $
 #
 #-------------------------------------------------------------------------
 
 NAME= ecpg
 SO_MAJOR_VERSION= 3
-SO_MINOR_VERSION= 0.7
+SO_MINOR_VERSION= 0.8
 
 SRCDIR= @top_srcdir@
 include $(SRCDIR)/Makefile.global
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index 2d16cb72471..2cb0e105479 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -515,6 +515,8 @@ ECPGexecute(struct statement * stmt)
 							return false;
 
 						strcat(mallocedval, tmp);
+						free(tmp);
+						
 						strcat(mallocedval, "'");
 
 						free(newcopy);
@@ -556,6 +558,8 @@ ECPGexecute(struct statement * stmt)
 							return false;
 
 						strcat(mallocedval, tmp);
+						free(tmp);
+						
 						strcat(mallocedval, "'");
 
 						free(newcopy);
diff --git a/src/interfaces/ecpg/test/test4.pgc b/src/interfaces/ecpg/test/test4.pgc
index c61d5f0c7f9..57a2143cc5b 100644
--- a/src/interfaces/ecpg/test/test4.pgc
+++ b/src/interfaces/ecpg/test/test4.pgc
@@ -1,3 +1,5 @@
+#include <locale.h>
+
 exec sql whenever sqlerror sqlprint;
 
 exec sql include sqlca;
@@ -11,6 +13,8 @@ EXEC SQL BEGIN DECLARE SECTION;
 	double f;
 EXEC SQL END DECLARE SECTION;
 	FILE *dbgs;
+
+	setlocale(LC_ALL, "de_DE");
         
 	if ((dbgs = fopen("log", "w")) != NULL)
                 ECPGdebug(1, dbgs);
@@ -21,9 +25,10 @@ EXEC SQL END DECLARE SECTION;
 
  	EXEC SQL BEGIN WORK;
 
-	EXEC SQL CREATE TABLE test (f decimal(8,2), i int, a int[10]);
+/*	EXEC SQL CREATE TABLE test (f decimal(8,2), i int, a int[10]);*/
+	EXEC SQL CREATE TABLE test (f float, i int, a int[10]);
 
-	EXEC SQL INSERT INTO test(f,i,a) VALUES(17000.00,1,'{0,1,2,3,4,5,6,7,8,9}');
+	EXEC SQL INSERT INTO test(f,i,a) VALUES(404.90,1,'{0,1,2,3,4,5,6,7,8,9}');
 
 /*	EXEC SQL INSERT INTO test(f,i,a) VALUES(140787.0,2,:a);*/
 
@@ -31,13 +36,6 @@ EXEC SQL END DECLARE SECTION;
 
 	EXEC SQL BEGIN WORK; 
 
-	EXEC SQL SELECT f::float
-         INTO :f
-         FROM test
-         WHERE i = :i;
-
-	printf("Found f::float=%f\n", f);
-
 	EXEC SQL SELECT f
          INTO :f
          FROM test
@@ -45,6 +43,13 @@ EXEC SQL END DECLARE SECTION;
 
 	printf("Found f=%f\n", f);
 
+	EXEC SQL SELECT i
+	 INTO :i
+	 FROM test
+	 WHERE f = :f;
+
+	printf("Found i=%d\n", i);
+
 	EXEC SQL DROP TABLE test;
 
 	EXEC SQL COMMIT;
-- 
GitLab