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

Commit0251602

Browse files
author
Michael Meskes
committed
Fixed two more memory leaks in ecpglib.
Synced parser.
1 parentff0ac57 commit0251602

File tree

3 files changed

+140
-75
lines changed

3 files changed

+140
-75
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.30 2006/01/17 19:49:23 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.31 2006/06/06 11:31:55 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -462,7 +462,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
462462
nres=PGTYPESnumeric_from_asc(pval,&scan_length);
463463

464464
/* did we get an error? */
465-
if (errno!=0)
465+
if (nres==NULL)
466466
{
467467
ECPGlog("ECPGget_data line %d: RESULT: %s errno %d\n",lineno,pval ?pval :"",errno);
468468

@@ -487,6 +487,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
487487

488488
if (garbage_left(isarray,scan_length,compat))
489489
{
490+
free(nres);
490491
ECPGraise(lineno,ECPG_NUMERIC_FORMAT,ECPG_SQLSTATE_DATATYPE_MISMATCH,pval);
491492
return (false);
492493
}
@@ -500,6 +501,8 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
500501
PGTYPESnumeric_copy(nres, (numeric*) (var+offset*act_tuple));
501502
else
502503
PGTYPESnumeric_to_decimal(nres, (decimal*) (var+offset*act_tuple));
504+
505+
free(nres);
503506
break;
504507

505508
caseECPGt_interval:
@@ -511,7 +514,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
511514
ires=PGTYPESinterval_from_asc(pval,&scan_length);
512515

513516
/* did we get an error? */
514-
if (errno!=0)
517+
if (ires==NULL)
515518
{
516519
if (INFORMIX_MODE(compat))
517520
{
@@ -534,6 +537,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
534537

535538
if (garbage_left(isarray,scan_length,compat))
536539
{
540+
free(ires);
537541
ECPGraise(lineno,ECPG_INTERVAL_FORMAT,ECPG_SQLSTATE_DATATYPE_MISMATCH,pval);
538542
return (false);
539543
}
@@ -544,6 +548,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
544548
ires=PGTYPESinterval_from_asc("0 seconds",NULL);
545549

546550
PGTYPESinterval_copy(ires, (interval*) (var+offset*act_tuple));
551+
free(ires);
547552
break;
548553
caseECPGt_date:
549554
if (pval)

‎src/interfaces/ecpg/pgtypeslib/interval.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.31 2006/03/11 04:38:39 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.32 2006/06/06 11:31:55 meskes Exp $ */
22

33
#include"postgres_fe.h"
44
#include<time.h>
@@ -793,6 +793,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr)
793793
returnNULL;
794794
}
795795

796+
errno=0;
796797
returnresult;
797798
}
798799

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp