Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd962385

Browse files
author
Michael Meskes
committed
Made ECPG more robust against applications freeing strings, based on
patch send in by Boszormenyi Zoltan <zb@cybertec.at>.
1 parent314288f commitd962385

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,6 +2438,11 @@ Thu, 01 Oct 2009 19:31:57 +0200
24382438

24392439
- Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to fix memory
24402440
leak in decimal handling.
2441+
2442+
Thu, 15 Oct 2009 12:15:31 +0200
2443+
2444+
- Made ECPG more robust against applications freeing strings, based on
2445+
patch send in by Boszormenyi Zoltan <zb@cybertec.at>.
24412446
- Set ecpg library version to 6.2.
24422447
- Set compat library version to 3.2.
24432448
- Set ecpg version to 4.6.

‎src/interfaces/ecpg/ecpglib/prepare.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.32 2009/07/22 11:07:02 mha Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.33 2009/10/15 10:20:15 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -152,14 +152,15 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c
152152
replace_variables(&(stmt->command),lineno);
153153

154154
/* add prepared statement to our list */
155-
this->name=(char*)name;
155+
this->name=ecpg_strdup(name,lineno);
156156
this->stmt=stmt;
157157

158158
/* and finally really prepare the statement */
159159
query=PQprepare(stmt->connection->connection,name,stmt->command,0,NULL);
160160
if (!ecpg_check_PQresult(query,stmt->lineno,stmt->connection->connection,stmt->compat))
161161
{
162162
ecpg_free(stmt->command);
163+
ecpg_free(this->name);
163164
ecpg_free(this);
164165
ecpg_free(stmt);
165166
return false;
@@ -238,6 +239,7 @@ deallocate_one(int lineno, enum COMPAT_MODE c, struct connection * con, struct p
238239
/* okay, free all the resources */
239240
ecpg_free(this->stmt->command);
240241
ecpg_free(this->stmt);
242+
ecpg_free(this->name);
241243
if (prev!=NULL)
242244
prev->next=this->next;
243245
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp