mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Do not eat memory even in case of an out-of-memory error.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user