mirror of
https://github.com/postgres/postgres.git
synced 2025-08-21 10:42:50 +03:00
Fixed one memory leak in descriptor code.
Made sure ecpg deletes output file in case of an error.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* dynamic SQL support routines
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.21 2007/04/27 06:56:11 meskes Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.22 2007/06/11 11:52:08 meskes Exp $
|
||||
*/
|
||||
|
||||
#define POSTGRES_ECPG_INTERNAL
|
||||
@@ -547,7 +547,7 @@ ECPGset_desc(int lineno, const char *desc_name, int index,...)
|
||||
ECPGfree(var);
|
||||
return false;
|
||||
}
|
||||
|
||||
ECPGfree(desc_item->data); /* free() takes care of a potential NULL value */
|
||||
desc_item->data = (char *) tobeinserted;
|
||||
tobeinserted = NULL;
|
||||
break;
|
||||
@@ -607,6 +607,18 @@ ECPGdeallocate_desc(int line, const char *name)
|
||||
{
|
||||
if (!strcmp(name, i->name))
|
||||
{
|
||||
struct descriptor_item *desc_item;
|
||||
|
||||
for (desc_item = i->items; desc_item;)
|
||||
{
|
||||
struct descriptor_item *di;
|
||||
|
||||
ECPGfree(desc_item->data);
|
||||
di = desc_item;
|
||||
desc_item = desc_item->next;
|
||||
ECPGfree(di);
|
||||
}
|
||||
|
||||
*lastptr = i->next;
|
||||
ECPGfree(i->name);
|
||||
PQclear(i->result);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.66 2007/04/27 06:56:11 meskes Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.67 2007/06/11 11:52:08 meskes Exp $ */
|
||||
|
||||
/*
|
||||
* The aim is to get a simpler inteface to the database routines.
|
||||
@@ -48,7 +48,7 @@ quote_postgres(char *arg, bool quote, int lineno)
|
||||
* will be quoted once they are inserted in a statement
|
||||
*/
|
||||
if (!quote)
|
||||
return res = ECPGstrdup(arg, lineno);
|
||||
return arg;
|
||||
else
|
||||
{
|
||||
length = strlen(arg);
|
||||
|
Reference in New Issue
Block a user