Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
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
pikelang
pike
Commits
02f92947
Commit
02f92947
authored
26 years ago
by
Henrik (Grubba) Grubbström
Browse files
Options
Downloads
Patches
Plain Diff
Fixed HSTMT leak.
Rev: src/modules/Odbc/odbc.c:1.8
parent
ebf914e8
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/modules/Odbc/odbc.c
+24
-2
24 additions, 2 deletions
src/modules/Odbc/odbc.c
with
24 additions
and
2 deletions
src/modules/Odbc/odbc.c
+
24
−
2
View file @
02f92947
/*
* $Id: odbc.c,v 1.
7
1998/0
4
/2
0
1
8:53
:4
2
grubba Exp $
* $Id: odbc.c,v 1.
8
1998/0
5
/2
9
1
9:04
:4
5
grubba Exp $
*
* Pike interface to ODBC compliant databases.
*
...
...
@@ -15,7 +15,7 @@
#endif
/* HAVE_CONFIG_H */
#include
"global.h"
RCSID
(
"$Id: odbc.c,v 1.
7
1998/0
4
/2
0
1
8:53
:4
2
grubba Exp $"
);
RCSID
(
"$Id: odbc.c,v 1.
8
1998/0
5
/2
9
1
9:04
:4
5
grubba Exp $"
);
#include
"interpret.h"
#include
"object.h"
...
...
@@ -233,8 +233,14 @@ static void f_select_db(INT32 args)
/**********************************************/
}
void
free_hstmt
(
HSTMT
hstmt
)
{
SQLFreeStmt
(
hstmt
,
SQL_DROP
);
/* Ignore return value. */
}
static
void
f_big_query
(
INT32
args
)
{
ONERROR
ebuf
;
HSTMT
hstmt
=
SQL_NULL_HSTMT
;
struct
pike_string
*
q
=
NULL
;
...
...
@@ -243,6 +249,9 @@ static void f_big_query(INT32 args)
odbc_check_error
(
"odbc->big_query"
,
"Statement allocation failed"
,
SQLAllocStmt
(
PIKE_ODBC
->
hdbc
,
&
hstmt
),
NULL
);
PIKE_ODBC
->
hstmt
=
hstmt
;
SET_ONERROR
(
ebuf
,
free_hstmt
,
hstmt
);
odbc_check_error
(
"odbc->big_query"
,
"Query failed"
,
SQLExecDirect
(
hstmt
,
(
unsigned
char
*
)
q
->
str
,
q
->
len
),
NULL
);
...
...
@@ -259,10 +268,23 @@ static void f_big_query(INT32 args)
ref_push_object
(
fp
->
current_object
);
push_object
(
clone_object
(
odbc_result_program
,
1
));
/* hstmt is now handled by the result program. */
UNSET_ONERROR
(
ebuf
);
}
else
{
odbc_check_error
(
"odbc->big_query"
,
"Couldn't commit query"
,
SQLTransact
(
PIKE_ODBC
->
henv
,
PIKE_ODBC
->
hdbc
,
SQL_COMMIT
),
NULL
);
UNSET_ONERROR
(
ebuf
);
/* hstmt is still handled by us. */
if
(
hstmt
!=
SQL_NULL_HSTMT
)
{
PIKE_ODBC
->
hstmt
=
SQL_NULL_HSTMT
;
odbc_check_error
(
"odbc->big_query"
,
"Freeing of HSTMT failed"
,
SQLFreeStmt
(
hstmt
,
SQL_DROP
),
NULL
);
}
push_int
(
0
);
}
}
...
...
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