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

Commit17bab8c

Browse files
author
Michael Meskes
committed
Moved some free() calls that coverity correctly complains about.
1 parent885a4d3 commit17bab8c

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,5 +2026,9 @@ we Jun 21 13:37:00 CEST 2006
20262026

20272027
- Added some more coverity report patches send in by Martijn van
20282028
Oosterhout <kleptog@svana.org>.
2029+
2030+
Su Jun 25 11:27:46 CEST 2006
2031+
2032+
- Moved some free() calls that coverity correctly complains about.
20292033
- Set ecpg library version to 5.2.
20302034
- Set ecpg version to 4.2.1.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dynamic SQL support routines
22
*
3-
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.15 2006/06/21 10:24:40 meskes Exp $
3+
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.16 2006/06/25 09:38:39 meskes Exp $
44
*/
55

66
#definePOSTGRES_ECPG_INTERNAL
@@ -349,7 +349,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
349349
return false;
350350
}
351351
/* allocate storage if needed */
352-
if (arrsize==0&&var!=NULL&&*(void**)var==NULL)
352+
if (arrsize==0&&*(void**)var==NULL)
353353
{
354354
void*mem= (void*)ECPGalloc(offset*ntuples,lineno);
355355
if (!mem)

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.48 2006/06/21 11:38:07 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.49 2006/06/25 09:38:39 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -896,7 +896,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
896896
if (!(mallocedval=ECPGrealloc(mallocedval,strlen(mallocedval)+slen+sizeof("array [] "),lineno)))
897897
{
898898
PGTYPESnumeric_free(nval);
899-
free(str);
899+
ECPGfree(str);
900900
return false;
901901
}
902902

@@ -905,8 +905,9 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
905905

906906
strncpy(mallocedval+strlen(mallocedval),str,slen+1);
907907
strcpy(mallocedval+strlen(mallocedval),",");
908+
ECPGfree(str);
909+
PGTYPESnumeric_free(nval);
908910
}
909-
PGTYPESnumeric_free(nval);
910911
strcpy(mallocedval+strlen(mallocedval)-1,"]");
911912
}
912913
else
@@ -929,12 +930,12 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
929930

930931
strncpy(mallocedval,str,slen);
931932
mallocedval[slen]='\0';
933+
ECPGfree(str);
934+
PGTYPESnumeric_free(nval);
932935
}
933936

934937
*tobeinserted_p=mallocedval;
935938
*malloced_p= true;
936-
PGTYPESnumeric_free(nval);
937-
free(str);
938939
}
939940
break;
940941

@@ -964,6 +965,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
964965
strcpy(mallocedval+strlen(mallocedval),"interval ");
965966
strncpy(mallocedval+strlen(mallocedval),str,slen+1);
966967
strcpy(mallocedval+strlen(mallocedval),",");
968+
ECPGfree(str);
967969
}
968970
strcpy(mallocedval+strlen(mallocedval)-1,"]");
969971
}
@@ -983,11 +985,11 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia
983985
strcpy(mallocedval,"interval ");
984986
/* also copy trailing '\0' */
985987
strncpy(mallocedval+strlen(mallocedval),str,slen+1);
988+
ECPGfree(str);
986989
}
987990

988991
*tobeinserted_p=mallocedval;
989992
*malloced_p= true;
990-
ECPGfree(str);
991993
}
992994
break;
993995

@@ -1163,6 +1165,7 @@ ECPGexecute(struct statement * stmt)
11631165
if (desc==NULL)
11641166
{
11651167
ECPGraise(stmt->lineno,ECPG_UNKNOWN_DESCRIPTOR,ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME,var->pointer);
1168+
ECPGfree(copiedquery);
11661169
return false;
11671170
}
11681171

@@ -1194,7 +1197,10 @@ ECPGexecute(struct statement * stmt)
11941197
desc_inlist.ind_offset=0;
11951198
}
11961199
if (!ECPGstore_input(stmt->lineno,stmt->force_indicator,&desc_inlist,&tobeinserted,&malloced))
1200+
{
1201+
ECPGfree(copiedquery);
11971202
return false;
1203+
}
11981204

11991205
break;
12001206
}

‎src/interfaces/ecpg/test/test_init.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace N
2323
#endif
2424

2525
int main(void)
26-
{ struct sa x,*y;
26+
{ struct sa x,*y=&x;
2727
exec sql begin declare section;
2828
int a=(int)2;
2929
int b=2+2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp