Skip to content

Commit e6c7f7c

Browse files
author
Michael Meskes
committed
Do not eat memory even in case of an out-of-memory error.
1 parent df5a996 commit e6c7f7c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,10 @@ Fri, 10 Oct 2008 14:03:05 +0200
23862386
Tue, 14 Oct 2008 11:25:51 +0200
23872387

23882388
- Fixed parameter parsing.
2389+
2390+
Sat, 25 Oct 2008 16:34:28 +0200
2391+
2392+
- Free allocated memory even if the next alloc failed with ENOMEM.
23892393
- Set pgtypes library version to 3.1.
23902394
- Set compat library version to 3.1.
23912395
- Set ecpg library version to 6.2.

src/interfaces/ecpg/compatlib/informix.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.55 2008/05/16 15:20:03 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/compatlib/informix.c,v 1.56 2008/11/01 08:55:21 meskes Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
@@ -755,10 +755,16 @@ rfmtlong(long lng_val, char *fmt, char *outbuf)
755755
fmtchar = ' ';
756756

757757
temp = (char *) malloc(fmt_len + 1);
758+
if (!temp)
759+
{
760+
errno = ENOMEM;
761+
return -1;
762+
}
758763

759764
/* put all info about the long in a struct */
760-
if (!temp || initValue(lng_val) == -1)
765+
if (initValue(lng_val) == -1)
761766
{
767+
free(temp);
762768
errno = ENOMEM;
763769
return -1;
764770
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy