Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
fc193739
Commit
fc193739
authored
15 years ago
by
Michael Meskes
Browse files
Options
Downloads
Patches
Plain Diff
Fixed incorrect memory management.
parent
2720c570
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/interfaces/ecpg/ecpglib/execute.c
+19
-19
19 additions, 19 deletions
src/interfaces/ecpg/ecpglib/execute.c
with
19 additions
and
19 deletions
src/interfaces/ecpg/ecpglib/execute.c
+
19
−
19
View file @
fc193739
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
6
2009/0
8
/0
7
10:
51:20
meskes Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.8
7
2009/0
9
/0
3
10:
24:48
meskes Exp $ */
/*
* 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
char
*
newcopy
=
NULL
;
/*
* arrays are not possible unless the attribute is an array too
FIXME: we
* do not know if the attribute is an array here
* arrays are not possible unless the attribute is an array too
*
FIXME: we
do not know if the attribute is an array here
*/
#if 0
if (var->arrsize > 1 &&...)
...
...
@@ -818,6 +818,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
nval
=
PGTYPESnumeric_new
();
...
...
@@ -833,15 +836,12 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
slen
=
strlen
(
str
);
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
);
return
false
;
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
...
...
@@ -885,6 +885,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
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
return
false
;
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
);
return
false
;
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
...
...
@@ -936,6 +936,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
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
return
false
;
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
);
return
false
;
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
...
...
@@ -987,6 +987,9 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
if
(
var
->
arrsize
>
1
)
{
if
(
!
(
mallocedval
=
ecpg_strdup
(
"array ["
,
lineno
)))
return
false
;
for
(
element
=
0
;
element
<
var
->
arrsize
;
element
++
)
{
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
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
);
return
false
;
}
if
(
!
element
)
strcpy
(
mallocedval
,
"array ["
);
strncpy
(
mallocedval
+
strlen
(
mallocedval
),
str
,
slen
+
1
);
strcpy
(
mallocedval
+
strlen
(
mallocedval
),
","
);
ecpg_free
(
str
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment