aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2008-11-01 08:55:21 +0000
committerMichael Meskes <meskes@postgresql.org>2008-11-01 08:55:21 +0000
commite6c7f7c1ad83f90d72faabb4adb73dd2e16c3daf (patch)
treead62745ee93b19ebf4f239ed83d31b04ccd94495
parentdf5a99612d2d4ba7ed080eb4dd02ce7e09a45f9b (diff)
downloadpostgresql-e6c7f7c1ad83f90d72faabb4adb73dd2e16c3daf.tar.gz
postgresql-e6c7f7c1ad83f90d72faabb4adb73dd2e16c3daf.zip
Do not eat memory even in case of an out-of-memory error.
-rw-r--r--src/interfaces/ecpg/ChangeLog4
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c10
2 files changed, 12 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog
index 928d412c953..3d8d6ab25f6 100644
--- a/src/interfaces/ecpg/ChangeLog
+++ b/src/interfaces/ecpg/ChangeLog
@@ -2386,6 +2386,10 @@ Fri, 10 Oct 2008 14:03:05 +0200
Tue, 14 Oct 2008 11:25:51 +0200
- Fixed parameter parsing.
+
+Sat, 25 Oct 2008 16:34:28 +0200
+
+ - Free allocated memory even if the next alloc failed with ENOMEM.
- Set pgtypes library version to 3.1.
- Set compat library version to 3.1.
- Set ecpg library version to 6.2.
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c
index c3c8749cf8f..b5ee3e67386 100644
--- a/src/interfaces/ecpg/compatlib/informix.c
+++ b/src/interfaces/ecpg/compatlib/informix.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.55 2008/05/16 15:20:03 petere Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.56 2008/11/01 08:55:21 meskes Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
@@ -755,10 +755,16 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
fmtchar = ' ';
temp = (char *) malloc(fmt_len + 1);
+ if (!temp)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
/* put all info about the long in a struct */
- if (!temp || initValue(lng_val) == -1)
+ if (initValue(lng_val) == -1)
{
+ free(temp);
errno = ENOMEM;
return -1;
}