Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
fc193739
Commit
fc193739
authored
Sep 03, 2009
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed incorrect memory management.
parent
2720c570
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/execute.c
+19
-19
No files found.
src/interfaces/ecpg/ecpglib/execute.c
View file @
fc193739
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
6 2009/08/07 10:51:20
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
7 2009/09/03 10:24:48
meskes Exp $ */
/*
/*
* The aim is to get a simpler inteface to the database routines.
* The aim is to get a simpler inteface to the database routines.
...
@@ -469,8 +469,8 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -469,8 +469,8 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
char
*
newcopy
=
NULL
;
char
*
newcopy
=
NULL
;
/*
/*
* arrays are not possible unless the attribute is an array too
FIXME: we
* arrays are not possible unless the attribute is an array too
* do not know if the attribute is an array here
*
FIXME: we
do not know if the attribute is an array here
*/
*/
#if 0
#if 0
if (var->arrsize > 1 &&...)
if (var->arrsize > 1 &&...)
...
@@ -818,6 +818,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -818,6 +818,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
nval
=
PGTYPESnumeric_new
();
nval
=
PGTYPESnumeric_new
();
...
@@ -833,15 +836,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -833,15 +836,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
PGTYPESnumeric_free
(
nval
);
PGTYPESnumeric_free
(
nval
);
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [] "
)
,
lineno
)))
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
2
,
lineno
)))
{
{
ecpg_free
(
str
);
ecpg_free
(
str
);
return
false
;
return
false
;
}
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
ecpg_free
(
str
);
...
@@ -885,6 +885,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -885,6 +885,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
str
=
quote_postgres
(
PGTYPESinterval_to_asc
((
interval
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
str
=
quote_postgres
(
PGTYPESinterval_to_asc
((
interval
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
...
@@ -892,15 +895,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -892,15 +895,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
return
false
;
return
false
;
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [],interval "
)
,
lineno
)))
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
2
,
lineno
)))
{
{
ecpg_free
(
str
);
ecpg_free
(
str
);
return
false
;
return
false
;
}
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
ecpg_free
(
str
);
...
@@ -936,6 +936,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -936,6 +936,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
str
=
quote_postgres
(
PGTYPESdate_to_asc
(
*
(
date
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
str
=
quote_postgres
(
PGTYPESdate_to_asc
(
*
(
date
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
...
@@ -943,15 +946,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -943,15 +946,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
return
false
;
return
false
;
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [],date "
)
,
lineno
)))
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
2
,
lineno
)))
{
{
ecpg_free
(
str
);
ecpg_free
(
str
);
return
false
;
return
false
;
}
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
ecpg_free
(
str
);
...
@@ -987,6 +987,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -987,6 +987,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
if
(
var
->
arrsize
>
1
)
{
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
{
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
str
=
quote_postgres
(
PGTYPEStimestamp_to_asc
(
*
(
timestamp
*
)
((
var
+
var
->
offset
*
element
)
->
value
)),
quote
,
lineno
);
...
@@ -995,15 +998,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
...
@@ -995,15 +998,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
slen
=
strlen
(
str
);
slen
=
strlen
(
str
);
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
sizeof
(
"array [], timestamp "
)
,
lineno
)))
if
(
!
(
mallocedval
=
ecpg_realloc
(
mallocedval
,
strlen
(
mallocedval
)
+
slen
+
2
,
lineno
)))
{
{
ecpg_free
(
str
);
ecpg_free
(
str
);
return
false
;
return
false
;
}
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
ecpg_free
(
str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment